I am trying to send a tiff file through fax machine.
This file seems fine with image viewer and paint, but
my boss told me that while trying to send the tif file using fax program,
he's getting pink all over his background instead of white..
and 40 kb of tif file bumps up to 600kb while trying to send the tif file..
And I used ImageMagick converting from PDF to Tiff, and the command line I used was
"C:/Program Files/ImageMagick-7.0.3-Q16/convert.exe" -density 200 -resize 1728x2291 -monochrome -compress group4 D://fax_files/201612/20161208155410.pdf D://fax_files/201612/example/1.tif
the pink image is here..
Did I make any mistakes on using ImageMagick or are there any issues that cause the problem?
If you know any, please help me out..
Thank you in advance..
I believe that to fax a tiff, it has to be binary (black/white), not color and needs to be compressed with group 4 compression.
With PDF files you need to set the density and units before reading the input and all the other arguments afterwards.
So
convert -density XXX -unit YYY image.pdf -resize ZZZ -monochrome -compress group4 image.tif
Related
I'd like to convert an image from .jpg to .png. This works just fine:
convert input.jpg output.png
But, I'm trying to have my output go to STDOUT instead of a file, which the manual says to use "-".
I tried using:
convert input.jpg -.png
But it just creates a file called -.png.
Is it possible to convert an image from one format to another and have it go to STDOUT?
Yes, just use a command like this to convert a JPEG to a PNG on stdout:
magick input.jpg PNG:-
These specifiers work on input as well as output. So, if you have a TIFF on stdin and want a 32-bit RGBA PNG on stdout:
magick TIFF:- PNG32:-
You often need these specifiers to ensure a specific filetype when it is not explicitly given, or you want to use a different extension. So, say you have some CCD device that produces RGB data in a raw binary file called image.bin and you want ImageMagick to read it. You can tell ImageMagick the format without having to change the filename (to image.rgb) like this:
magick -size WxH RGB:image.bin result.png
The possible formats are documented here.
The king of all of these formats is MIFF which is guaranteed to be able to hold any and all things you might throw at it, including floating-point values, transparency, masks, concatenated streams... so if you need a format to pass between ImageMagick commands, MIFF is a good option. An example, just to demonstrate because it is not optimal, might to be to concatenate two images from 2 separate ImageMagick commands into a third command that makes an animated GIF:
{ magick -size 100x60 xc:red miff:- ; magick -size 100x60 xc:blue miff:- ; } | magick -delay 80 miff:- result.gif
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.
I have tried adding the option -depth 12 to the string
convert transparentPNG.png -resize 500x400 -background white -flatten -depth 12 png_small.jpg
The input file is a transparent png to which I'm adding a background and then changing the depth. But the depth remains the same as 8bits. I verified the same using the -verbose.
I'm not sure what could I be doing wrong here. I'm referring to the site link
The transparent input png file used for my test can be found here
Let me know if you have any questions on the tests i did. Hoping to get some tips.
A JPG can only be 8-bit, so your internal 12-bit image is converted back to 8-bit when you save the result.
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.
I have been using the batch method to convert any number of PDFs to any other format in any DPI (Best way to convert pdf files to tiff files).
ImageMagick was updated (I run ImageMagick-7.0.3-Q16), and I though the old command:
convert -density 300 -compress LZW testfile.pdf testfile.jpg
could just be changed to:
magick -density 300 -compress LZW testfile.pdf testfile.jpg
Both the 'density' and the 'compress' functionality appear in the new manual... It does create a jpg, however, the DPI is 96 (default?) and it seems that the actual dimensions of the figure increases a lot.
(The actual text in the .bat file is
for %%f in (%*) DO "C:\Program Files\ImageMagick-7.0.3-Q16\magick.exe" -density 300 -compress LZW %%f %%f.jpg
but the issue also appears when I run the simplified code above...