Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix incorrect image size #8

Open
GoogleCodeExporter opened this issue Jul 21, 2015 · 0 comments
Open

How to fix incorrect image size #8

GoogleCodeExporter opened this issue Jul 21, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link


So it looks like this project has essentially been abandoned - here's a tip for 
anyone else looking to use it to any great extent:

The size of the image will not be correctly regardless of whether you call the 
setSize method or not. Instead follow these steps:

1. do NOT call setSize - it makes no difference at all to picture size
2. The size should be set on the top level container in your HTML (e.g. set CSS 
width and height of top div).
3. This will make the image, on average, 1.322 scale of what you expected.
4. To solve this, simple multiply the width/height values by 0.7625f (this 
seems to be a sweet spot but you could make it more accurate still).

I use: int width = Math.round(origWidth*0.7625f); - and same again for height.

This should give you the correct height within around 3px on each axis for 
pictures less than 1024*768 in size.

Hope this helps someone, pity this library is no longer under development 
although looking at the code it uses a lot of weird tricks to force the HTML 
into an image format. 

Cheers,

Jack

Original issue reported on code.google.com by [email protected] on 25 Apr 2012 at 11:33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant