GNOME Bugzilla – Bug 553888
Exported chart in png is smaller in dimension than the original one
Last modified: 2009-12-29 20:24:16 UTC
it is sometimes off-by-1 pixel, sometimes off-by-2 pixels. After digging into code for a while, it seems the width/height passing to cairo_image_surface_create is truncated (inside gog_renderer_update). e.g. width: 500.989999, but after rend->w = w, rend->w becomes 500. But it can only explains part of the problem, and can be solved by changing rend->w = w; rend->h = h; to rend->w = w + 0.5; rend->h = h + 0.5; But after that, it is still always off-by-1. If i change the 0.5 to 1.5, the problem is fixed. However, i don't think it is an appropriate solution to the problem, so would like to help from the experts here for correct solution.
What is the API you are using for the image rendering ? A small example of what you are doing would be nice.
we're calling this function on the sheet object to get a png image. sheet_object_write_image (so, format, -1.0, output, &err);
I'm unable to reproduce that isuue from gnumeric. Do you use a implied screen resolution different from 96 pixels per inch?
i've tried using the gnumeric client (1.8.3@16606) to export the png file, and explicitly set the pixels per inch as 96. The exported image is off-by-1 in dimension. I'll attach the gnumeric file in a minute.
Created attachment 119572 [details] try saving the chart as image (png with 96 pixels per inch)
I get a 425*204 pixels, just the same size as in the sheet.
attaching a sample .c file for reproducing the issue. I've tried it with http://svn.gnome.org/svn/gnumeric/tags/GNUMERIC_1_8_3
Created attachment 120695 [details] Sample .c file for reproducing the bug on tags/GNUMERIC_1_8_3
I still can't reproduce, can you attach the gnumeric file you used?
Hmm, also tested with the first attachment, end getting the correct 425x204 png.
Can you attach the png file you obtained? I really cannot reproduce, either with trunk or the 1.8 branch.
Still getting no where replicating this. We're going to need more information.
I open the file of comment #5 in gnumeric (current git). The chart is apparently 425 by 204 pixels. I can verify this in both the new size/position editor and the tool tip while hovering over the bottom right corner. I have verified in edit->preferences that both horizontal and vertical screen resolution is set at 96. I save the image as a png making sure that the export setting resolution is set to 96. I open the saved file in Gimp and check the image properties. The size is 425 by 204 pixels. This is exactly the size I started out with. Unless you can provide us with the png you created from the above file (ideally with gnumeric 1.9.x (x>14)) we really can't address this issue.