Converting .eps to .jpg - image-processing

Our print team saves raster images as .eps files. We need to convert about 11000 .eps to .jpg. We are using ImageMagick (with Ghostprint) on Linux. The conversion occurs but the resulting .jpg is not the same size as the source .eps - It's about 1/2 the size. Probably a problem converting a vector to a raster. Any way to solve this?

Your using the default resolution (72dpi). use the -density option to specify a dpi to convert.
convert -density 300 /path/to/file.eps -flatten /path/to/file/.jpg;

Related

How to restrict tiff file size using ImageMagick and python?

I am converting a pdf to .tiff file using ImageMagick and calling it from python using subprocess,run() but, I want the output file size to be limited to a maximum value say 40MB. -define extent max_value is not working for tiff like it works for jpeg images.
This is my code:
subprocess.run('magick convert -density 150 example.pdf -trim -thumbnail 500 result%04d.tif')

Why does imagemagick convert increases file-size

I am using ImageMagick to convert png files to tiff. But after conversion the file size seems to increase by a huge amount? Any suggestion on what am i doing wrong here?
Command that I am using for conversion is : convert tiftest1.png tiftest2.png output_file.tif
PNG files are analysed (filtered) on a line-by-line basis to see how best each line can be compressed relative to the previous one, then compressed. TIFF files, in general, are not.
You need to consider whether you can accept lossless or lossy compression and then tell the TIFF encoder.
If only lossless compression is acceptable:
magick input1.png input2.png -compress LZW result.tif
If lossy compression is acceptable (and compatible with downstream needs):
magick input1.png input2.png -compress JPEG result.tif
Check actual compression used in a file with:
magick identify -verbose image.tif
Check available types of compression with:
magick identify -list compress
When converting to tiff, ImageMagick produces a non-compressed file by default. You can tell it to use LZW or ZIP or JPEG or other compressions. PNG is always compressed.

how to convert scanned jpg files to pbm format losslessly?

Using ImageMagick's convert utility to convert some scanned jpg files to pbm files.
However, even if the option -quality 100 is used, the pbm's resolution still looks worse than the original scanned jpg file.
Worse, the scanned jpg file is a colored one, while the converted pbm is black and white.
Info of original jpg:
image size: 2256 × 1568 pixels
dpi: 300 pixels/inch
color model: RGB
info of the converted pbm:
image size: 2256 × 1568 pixels
dpi: 72 pixels/inch
color model: Gray
Currently, here is what I did to convert the format:
qiang#bonjour:~/scan$ convert scan000.jpg scan000.pbm
Am I missing any option to use with convert? As I mentioned earlier, -quality 100 had been tried, but to no avail.
Using ImageMagick, I think you want to output to PPM not PBM. Try
convert image.jpg image.ppm
or try the ascii version by using
convert image.jpg -compress none image.ppm
PBM is binary (black/white) and PGM is grayscale. If you want to keep color, then you need to use PPM.
Unfortunately, I believe that ImageMagick can only read DJVU format images. So you cannot write to it directly from ImageMagick.

How to convert a .eps file to a high quality 1024x1024 .jpg?

I have a .eps file that I can look at in Photoshop, and it has a very high resolution, sharp edges, etc. at even larger than 1024x1024.
With ImageMagick I want to convert this .eps to a 1024x1024 .jpg with very high resolution.
However, with the following command, the image is very blurry:
convert -resize "1024x1024" -colorspace RGB -flatten test.eps test.jpg
What ImageMagick parameters do I have to use so that the resulting .jpg is 1024x1024 and a high quality, sharp image?
here's some XMP data we found, perhaps what is causing it to not be resized with -size:
For vector graphics, ImageMagick has both a render resolution and an output size that are independent of each other.
Try something like
convert -density 300 image.eps -resize 1024x1024 image.jpg
Which will render your eps at 300dpi. If 300 * width > 1024, then it will be sharp. If you render it too high though, you waste a lot of memory drawing a really high-res graphic only to down sample it again. I don't currently know of a good way to render it at the "right" resolution in one IM command.
The order of the arguments matters! The -density X argument needs to go before image.eps because you want to affect the resolution that the input file is rendered at.
This is not super obvious in the manpage for convert, but is hinted at:
SYNOPSIS
convert [input-option] input-file [output-option] output-file
Maybe you should try it with -quality 100 -size "1024x1024", because resize often gives results that are ugly to view.

Resizing an Image using Imagemagick convert

I have a YUV420 image of size 1280x720. I am trying to resize it to 720x576 using convert (Imagemagick) using below commandline options. But the generated output file doesnot seem to be a proper resized YUV420 image(I want the resized output also to be in YUV420 format):
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -filter lanczos -resize 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv //Here the output file size is not what it should be of a 720x576 YUV420 file which is 720x576x1.5 bytes.
Qiestion: What is the format of this output file then?
Also tried -sample option as, but same result. Incorrect sized output file. I even tried to display the generated resized file, but it sure is not a YUV420 file, as could not view it correctly at all.
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -sample 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv
Question: Would convert be able to do what I am trying to get done? IF yes, what are the options?
Question: Any other tool(freeware,shareware) which could help me resize YUV files(different formats YUV420, YUV444) to YUV format output files?
Try to ignore aspect ration!
Ignore Aspect Ratio ('!' flag)
If you want you can force "-resize" to ignore the aspect ratio and distort the image so it always generates an image exactly the size specified. This is done by adding the character '!' to the size. Unfortunately this character is also sometimes used for special purposes by various UNIX command line shells. So you may have to escape the character somehow to preserve it.
Example:
convert image.gif -resize 64x64\! resized_image.gif //Resized Image with ignore ratio option

Resources