GNOME Bugzilla – Bug 645938
image exported to .png is truncated
Last modified: 2012-01-12 21:45:55 UTC
Created attachment 184450 [details] the .gnumeric file to reproduce the problem Steps to reproduce the problem: - open the attached .gnumeric file - right-click the graph and go to 'export as image' - choose png as format - open the saved file with, e.g. eog => the right part of the image is truncated
I would think that this is related to the size of the image: 5594 pixels wide.
The truncation depends on the chosen resolution for the image, so it is like there is a size-limit.
The "resolution" just changes the size of the resulting png. It seems that the problem appears when the resulting width is over 15000.
I have verified that the pixbug in-memory is wrong, i.e., saving is not the culprit. Current suspect: #define GO_CAIRO_CLAMP(x) CLAMP((x),-15000,15000)
Changing GO_CAIRO_CLAMP to -5000 to 5000 it is easy to see that this is indeed the culprit. (The purpose of GO_CAIRO_CLAMP is to avoid the cairo limitation of 16 bit coordinates. Perhaps this should be handled by scaling the coordinates rather than truncating them.
Scaling the coordinates for vectorial formats export makes sense. For bitmaps, I think the best is to not accept to export so large images.
Strange, changing GO_CAIRO_CLAMP(x) to just (x) makes things apparently work.
Well, it looks to me like most of this is done in doubles anyways. So having large values one would just loose resolution which of course is hardly visible...
I'm not sure about that. The canvas use very large coordinates in extreme cases. I tested with 16M rows, 1000 pixels high each, and I did not see any resolution loss. I did not read all cairo code to see what was done using double or cairo_fixed_t coordinates. Actually cairo_fixed_t is a 24,8 structure, not 16,16, so it seems it can support up to 8M pixels. Of course, I might be full wrong. Just the 15000 limit seems weird. 16 bits allow for 32K.
I think we really should change this to 8M. The 15000 limit is to small!
Agreed.
Done, crossing fingers. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.