I have ImageMagick version 6.6.9.7 and using convert for PDF to JPG thumbnails.
Spaces with no text on the thumbnail are black.
I've installed latest version of GhostScript, tried various methods of fixing (adding -colorspace 'rgb', -flatten, -alpha off, -background white) etc but nothings working.
Does anybody know how to fix this?
First suggestion would be to reduce the scope of the problem. Try using Ghostscript to convert the PDF to JPEG instead of using ImageMagick. If that works as exepcted then you know the problem is ImageMagick, if it doesn't then you can blame Ghostscript.
gs -sDEVICE=jpeg -o out.jpg
If that works then the problem may be in ImageMagick, or it may be the Ghostscript command line which ImageMagick is manufacturing, in which case you'll need to find out what that is, and I can't tell you how to find that out. But try the above and see what you get.
Related
I want to get the raw binary data of an image but I don't know how to do that. Is any module available there to do that? I need some help. If anyone knows the solution to this help me.
The easiest way is probably just with ImageMagick in your Terminal. Say you have a JPEG and want the RGB pixel values in binary without headers or anything:
magick INPUT.JPG -depth 8 RGB:output.bin
Or you have a PNG and want RGBA data:
magick INPUT.PNG -depth 8 RGBA:output.bin
I'm using a GraphicsMagick package for image processing
When converting Illustrator (.ai) files to .png files, I end up losing transparency so the background ends up white.
I don't have this problem when using the same options and converting with ImageMagick, but I need a solution to make it work with GraphicsMagick specifically.
I don't have much experience with GraphicsMagick, but I would assume that the behavior of -background is the same as ImageMagick's:
gm convert -background transparent source.ai out.png
Note: This works by defining the background before reading the vector graphic
For a project of mine I'm fetching websites favicons and storing them to be displayed in a website. Sounds pretty trivial, but I have one strange issue. Almost all icons come in a .ico format, which is not very web friendly. Some icons also have different sizes in them.
I'm using Imagemagick to convert them to PNG and extract only the 16x16 icon.
I'm using the following command line for this:
convert source.ico -geometry 16x16 -alpha on -background none -flatten out.png
Unfortunately on some icons this creates some nasty horizontal black stripes in the transparent areas. Here is an example:
This is the original icon:
http://g.etfv.co/http://www.mysqlperformanceblog.com/
This is the result:
http://img585.imageshack.us/img585/1463/65407408.png
Here it is again embedded here:
What could be wrong here? My ImageMagick is version 6.5.4-7
Try updating your Imagemagick installation: I tried your command with your .ico file with version 6.6.0-1 and it created the png file correctly
Version: ImageMagick 6.6.0-1 2010-03-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
I have to write a windows command line shell script to convert pdf to Images.
Sample command:
convert.exe -density 300x300 -resize 3508x <file>.pdf -units PixelsPerInch -profile srgb.icc <FILE>.jpg
This command works fine for pdfs with NON-White background but goes wrong with pdfs with WHITE background. Any idea how I can give a command that works for both?
Plus
1) If the PDF is converted to .png ( as opposed to .jpg) it works. Any idea why?
This might be helpful, Save pdf to jpeg using c#.
Also have a look here.
I have an SVG with many polygons:
https://github.com/barrycarter/bcapps/blob/master/sample-data/current-temps.svg
that looks somewhat like this:
Cropping this and converting to PNG works fine:
convert -crop 100x100+200+150 current-temps.svg /tmp/exhb2.png
Cropping and scaling, however, fails:
convert -crop 100x100+200+150 -scale 1000x750 current-temps.svg /tmp/exhb3.png
How do I make ImageMagick "zoom into" the SVG before cropping?
(I realize ImageMagick can only read, not write, the SVG format, but
it should still be able to do what I want?)
EDIT/SOLVED:
Thanks, robermorales.
inkscape -z -e out4.png -w 1000 -h 1000 -a 200:200:400:400 current-temps.svg
(for example) worked like a charm.
I also realized that copying the SVG, tweaking the transform line:
<g transform="scale(3,3) rotate(-90) translate(-90,180)">
and then converting to PNG is another solution.
Try doing scale before crop.
However, doing that using inkscape cli is easier.
Sorry for no links, afk
Don't crop an SVG into PNG.
You can use viewBox to re-define the crop area then convert that SVG into PNG in highest solution as possible.
Check this post https://www.sarasoueidan.com/blog/svg-coordinate-systems/ explain what is viewBox and you will got my idea.
Proper ImageMagick syntax here is to read the input, then crop, then resize. See http://www.imagemagick.org/Usage/basics/#why Though that is not likely the issue. The issue is that -scale will replicated pixels and so make it blocky. You should replace -scale with -resize. That will be smoother, but blurry for the amount of magnification you are requesting. Try this command:
convert current-temps.svg -crop 100x100+200+150 -resize 1000x750 exhb3.png