-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve density/resolution of vector input images #110
Comments
I've added support for |
Hi, 7.42 is out now with this feature. |
Thanks John, I'll expose this feature after moving to libvips' new C++ bindings. |
I think I totally need this, or at least something like this. I've got an Adobe Illustrator file that I'm converting to PNG. I need the ability to specify the density for the output PNG. |
@lovell To be clear, it is a .ai file, not .eps. =) Conversion is done with ghostscript+graphicsmagick |
@lookfirst Thanks, I've updated the title accordingly. |
Commit fdb27e1 on the |
@lovell This looks really nice! |
There's an interesting related issue here: https://github.com/jcupitt/libvips/issues/379 I'll have a stab at a libpoppler loader. |
... jcupitt/libvips#379 has some benchmarks now, it's up to about 500x (!!???!?!) faster. What features do you need in a vector graphics loader? Please feel free to add any ideas to the TODO on that issue. |
@jcupitt Wow, that's quite an improvement. SVG is the vector format that has generated the most questions from sharp users. Given poppler's dependency on cairo, would support for loading via librsvg also make sense here? |
Sure, I think that's a good idea. It should be a fairly simple copy-paste job to make |
... I guess better GIF support is also asked for a lot. I don't know what the best gif library is. |
@jcupitt The public domain STB library provides a common API for decoding GIF, PSD and a few others at https://github.com/nothings/stb/blob/master/stb_image.h |
I don't like the STB stuff, it seems broken by design to me. It makes my skin crawl! I'll add a note about finding a gif library to the TODO. |
I had a quick hack at a librsvg reader. This is a simple copy-paste from the new https://github.com/jcupitt/libvips/tree/add-librsvg It's fast! I see:
vs. git master, still using the libMagick pathway:
It's not correctly loading from a memory buffer yet, I'm not sure why. |
OK, fixed it, it seems to work well now. I think the remaining issue is file type sniffing. At the moment it relies on files ending in Files not called Do you know a good detect-svg rule? I guess first line starts https://github.com/jcupitt/libvips/blob/add-librsvg/libvips/foreign/svgload.c#L366 |
@jcupitt That's fast, and that's fast! The |
Thanks @lovell, I've put something better in. I'll merge to master as soon as CMYK PDFs are sorted out. |
v0.13.0 now available, thanks everyone for the comments and help with this. I'll create a separate issue to take advantage of libvips' new SVG and GIF loaders when v8.3.0 is available. |
One more related thing: the By default it always picks page zero, I don't know if sharp would need to expose this. |
@lovell I'm playing with this and I'm a bit confused. I'm trying to read in a .ai file and output a .png file. I'd like the png to be output as 300dpi. Right now, I'm getting 25 dpi for the png file with sharp 0.13.0. Any ideas? Thanks!
|
@lookfirst In your example, this bitmap is then resized. Perhaps temporarily remove the
Once an image is in bitmap form, the DPI is mostly arbitrary - see #96 for why there are only "25" of them :) |
(As originally suggested by @bradisbell in #105.)
libmagick is able to parse vector SVG files as bitmaps but the resolution is poor due to the default 72 (96?) DPI/density setting.
The text was updated successfully, but these errors were encountered: