Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:46:35+00:00 2026-06-15T08:46:35+00:00

Using the jcrop library and I can not track down why the return object

  • 0

Using the jcrop library and I can not track down why the return object on callbacks can and sometimes contain decimals. I expect all x1, x2, y1, y2, width and height to be integers.

my initialization for jcrop is:

$('img.jsEditable').Jcrop({
    bgColor: 'black',
    bgOpacity: .4,
    setSelect: [0, 0, crop_width, crop_height],
    aspectRatio: 1,
    onSelect: saveCoordinates,
    minSize: [crop_width, crop_height],
    maxSize: [400, 400]
  });

where crop_width and crop_height is simply variables I set somewhere else, and happens to be 150. I am expecting (as in the demo’s) for them to be a set pixel.

Any thoughts?
Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:46:36+00:00Added an answer on June 15, 2026 at 8:46 am

    This appears to be a difference between Jcrop 0.9.9 and 0.9.10. If you go to the demo from the website, http://deepliquid.com/projects/Jcrop/demos.php?demo=handler and drag the box around you will only get integers in the callback. The demo is not up to date and is using Jcrop 0.9.9.

    However, if you download Jcrop you get version 0.9.10. The demo included in the download also uses Jcrop 0.9.10 and you get decimals in the callback. If you swap out version 0.9.10 in the demo and use 0.9.9 instead you only get integer coordinates in the callbacks.

    Looking into this further, it looks like in version 0.9.10 in jquery.Jcrop.js on line 656 the rounding of the coordinates was removed. The return went from:

    return [ Math.round(xa), Math.round(ya), Math.round(xb), Math.round(yb) ];
    

    to

    return [xa, ya, xb, yb];
    

    I’m not sure of the reasons for this (I looked through the commit comments on github but nothing jumped out at me) but if you add the rounding back in you won’t get decimals any more on the callbacks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using jcrop to crop pictures on my websites. user can have any
I am using jcrop to crop the image in my php application.I am using
I am using jcrop to implement image cropping in my site. After clicking on
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using the Redis info command, I am able to get all the stats of
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
I'm at a loss. I'm using JQuery 1.4.2 and JCrop 0.98. Everything else works
I want to crop an image at the server side (I am using 'JCrop'
Using Android TelephonyManager an application can obtain the state of data activity over the
I am using Jcrop jQuery to crop an image in an MVC3 application. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.