After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 553888 - Exported chart in png is smaller in dimension than the original one
Exported chart in png is smaller in dimension than the original one
Status: RESOLVED INCOMPLETE
Product: Gnumeric
Classification: Applications
Component: Charting
1.8.x
Other Linux
: Normal normal
: ---
Assigned To: Jean Bréfort
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2008-09-26 03:53 UTC by Reggie Chan
Modified: 2009-12-29 20:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
try saving the chart as image (png with 96 pixels per inch) (13.45 KB, application/octet-stream)
2008-09-29 11:20 UTC, Reggie Chan
Details
Sample .c file for reproducing the bug on tags/GNUMERIC_1_8_3 (2.51 KB, text/plain)
2008-10-16 07:36 UTC, Reggie Chan
Details

Description Reggie Chan 2008-09-26 03:53:07 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.
Comment 1 Emmanuel Pacaud 2008-09-26 09:46:59 UTC
What is the API you are using for the image rendering ?

A small example of what you are doing would be nice.
Comment 2 Reggie Chan 2008-09-26 10:21:54 UTC
we're calling this function on the sheet object to get a png image.

sheet_object_write_image (so, format, -1.0, output, &err);
Comment 3 Jean Bréfort 2008-09-27 06:11:57 UTC
I'm unable to reproduce that isuue from gnumeric. Do you use a implied screen resolution different from 96 pixels per inch?
Comment 4 Reggie Chan 2008-09-29 11:19:05 UTC
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.
Comment 5 Reggie Chan 2008-09-29 11:20:24 UTC
Created attachment 119572 [details]
try saving the chart as image (png with 96 pixels per inch)
Comment 6 Jean Bréfort 2008-09-29 11:33:00 UTC
I get a 425*204 pixels, just the same size as in the sheet.
Comment 7 Reggie Chan 2008-10-16 07:35:22 UTC
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
Comment 8 Reggie Chan 2008-10-16 07:36:30 UTC
Created attachment 120695 [details]
Sample .c file for reproducing the bug on tags/GNUMERIC_1_8_3
Comment 9 Jean Bréfort 2008-10-16 10:06:36 UTC
I still can't reproduce, can you attach the gnumeric file you used?
Comment 10 Jean Bréfort 2008-10-16 10:09:20 UTC
Hmm, also tested with the first attachment, end getting the correct 425x204 png.
Comment 11 Jean Bréfort 2008-11-11 13:18:06 UTC
Can you attach the png file you obtained? I really cannot reproduce, either with trunk or the 1.8 branch.
Comment 12 Jody Goldberg 2009-02-06 03:48:35 UTC
Still getting no where replicating this.
We're going to need more information.
Comment 13 Andreas J. Guelzow 2009-12-29 20:24:16 UTC
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.