[cairo] PNG Export In Inkscape Via Pixman Library

Siarhei Siamashka siarhei.siamashka at gmail.com
Tue Nov 24 16:12:08 UTC 2020


On Sun, Nov 22, 2020 at 11:48 PM DJ Paul <tiggerdjpaul at gmail.com> wrote:
>
> forgot to ask you to link this to inkscape#543 bug report.
>
> Thank You,
>
> David Paul
>
> On Sun, Nov 22, 2020 at 3:40 PM DJ Paul <tiggerdjpaul at gmail.com> wrote:
>>
>> Hello,
>>
>> Summary:
>> I am using Inkscape as my main drawing program and have been since version 0.48 or so.  Somewhere along the way, I had been able to use the PNG export feature to export large banners with large pixel counts, however, this is no longer working well.
>>
>> Best I can tell, it worked better with Inkscape 0.48 on Mac OS 10.11.6 which was El-Capitan {Not sure as the computer has been updated since then}.  I have recently updated to Mac OS 10.14.6 and cannot get this to work as I needed.  I had submitted a bug to Inkscape, they narrowed it down the Pixman library and said to open a ticket with you.
>>
>> Details:
>> I am trying to export a PNG from a drawing that is 10'x3' at 300dpi or 600dpi.  Highest it will reliably is hard to figure out, but it seems to be somewhere between 150dpi.  If I try to go higher, I just get blank or corrupted PNG files.
>>
>> I have PNG files from similar 2017-2018 projects with pixel sizes of 30,000 x 9,000 which is ~250dpi at 10'x3'  Inkscape would also not do the 300dpi requested by the printers then, but the latest version won't do this size.
>>
>> Versions of Inkscape I have tried on Mac OS 10.14.6 are 0.48, 0.91, 0.92, 1.00, and 1.01 and they all currently have this issue.  I have also tried Inkscape 0.92 on the latest version of Ubuntu Studio and windows 10 with similar results.
>>
>> This issue also seems to be independent of the drawing size. If I try to export a 10"x3" drawing to the 36,000 x 10,800 pixels I get similar results when exporting a 10'x3' banner at 36,000 x 10,800 pixels.
>>
>> Is this a bug or beyond the Pixman library's function?  Either way, I would like to be able to export high dpi, banner sized images from Inkscape.  Biggest I can see me using is 86400x86400 pixels which is a 12'x12' image @ 600dpi.
>>
>> Output image size should not depend on the actual size of the drawings.  Drawing sizes can greatly change the result of Inkscape's filters.  So if I have an 10"x3" picture, I'd still like to be able to export that to a 36,000 x 10,800 pixel image to print a 10'x3' banner @ 300dpi.
>>
>> Attached Files:
>>    Inkscape Drawing: Banner_Background_1_10ftx3ft.svg
>>    PNG Export Settings: PNG_Export_Dialog_1.png
>>    Resulting PNG File: Banner_Background_1_36000x10800.png

Hello,

Right now pixman library has a 32k limit for coordinates and image sizes
due to its use of 16.16 fixed point format for many things. This is good
enough to be a software rendering backend for the X server (which has
the same limitation).

The old pixman commit
https://cgit.freedesktop.org/pixman/commit/?id=e841c556d59ca0aa6d86eaf6dbf061ae0f4287de
only extended the data type of input arguments from int16_t to int32_t
without making any changes in the code to actually make large images
work correctly in all cases. I can't find any old discussion in the
mailing list about this particular patch. I can only speculate that
it probably worked correctly for some narrow use case and was deemed
to be useful.

My personal opinion is that adding this 32-bit API was a mistake.
Pixman is very reliable and almost bug-free when using 16-bit
coordinates and image sizes. But exceeding this limit results in
unpredictable behaviour (it may work or it may fail).

No real work to actually implement large images support happened
in all these years. I remember some patches, which tried to
improve something, but they were submitted without extending the
test suite (to demonstrate a failure before the patch and a correct
functionality after applying it).

I think that a proper way to add full support for large images is
to start with reworking the test suite and provide full coverage
for this functionality. The test suite will identify a large number
of problems to fix. And it will also ensure that the large images
support will not regress in the future. I actually was ready to
take care of this when I was still working for Nokia, but my
management wasn't convinced that pixman large images support was
actually useful. After leaving Nokia, I had a talk with Mozilla
people at one of the FOSDEM conferences and asked if they might
be interested in me doing any improvements for pixman as a
contracted work. But Mozilla was already moving away from
cairo/pixman to skia. The hard reality is that no corporate
money is willing to sponsor pixman or cairo development nowadays.

That said, I'm not doing any pixman work anymore. And if somebody
comes up with a set of patches to improve your inkscape use case
(regardless of improving the test coverage or not), then it will
be up to the current pixman maintainers to accept these patches
or not. And my opinion is pretty much irrelevant.

-- 
Best regards,
Siarhei Siamashka


More information about the cairo mailing list