Page 1 of 2

re: Install ImageMagick on window

Posted: 2017-10-17T11:05:51-07:00
by minhtran
Hello, I am a newbie and I tried to install ImageMagick on window for my school project. I google some sites on installation , and one of the site recommended running Cygwin and ImageMagick. It may serve purpose since I want to run ImageMagick command line though Cygwin. Cygwin is installed and running, and I try next to install ImageMagick. However, when I tried to install
ImageMagick through cywin command line such as following from the note:
$ gzip -dc /path/to/package.tar.gz| tar -xf-

It came back and said
gzip: /path/to/package.tar.gz: No such file or directory
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors


I maybe missing some important things so if you could spot what I am missing, please let me know.
Also what would you suggest if I need to install both cygwin and Imagemagick in order to run the ImageMagick command line? Is this necessary or you may have a better way to do it?

Many thanks!!

Re: re: Install ImageMagick on window

Posted: 2017-10-17T11:20:43-07:00
by snibgo
minhtran wrote:Also what would you suggest if I need to install both cygwin and Imagemagick in order to run the ImageMagick command line?
When you have installed IM on Windows, you can run it from the Windows command line, or from the Cygwin command line. The ordinary Windows binary (from http://www.imagemagick.org/script/download.php#windows ) works fine with Cygwin.

See my page IM with Cygwin

If you want to build IM under Cygwin, see Compiling IM with Cygwin

Re: re: Install ImageMagick on window

Posted: 2017-10-17T12:03:35-07:00
by Bonzo
I run Imagemagick under Windows 10 with the command line, batch scripts and a webserver localhost. I can not see the point in using Cygwin unless you want to run Linux type shell scripts.

Re: re: Install ImageMagick on window

Posted: 2017-10-17T12:53:19-07:00
by snibgo
Cygwin has the standard Unix tools: sed, awk, bc and so on. These can be run from the Windows command line or scripts. As Windows doesn't include equivalents for these utilities, this is useful.

Cygwin has bash, which is useful for people who want or need it.

Ordinary Windows programs can run under Cygwin bash, and Unix utilities can be run from the Windows command line. Apparently that isn't true of Microsoft Windows 10 bash: MS bash programs can't run under MS Windows command line, or vice versa. (Yeah, this seems stupid.)

Personally, I hate bash. I also hate Windows command and BAT, but I hate bash even more.

And don't get me started on the cryptic 1970s user interfaces to the Unix utilities. But they work, and do useful jobs.

Re: re: Install ImageMagick on window

Posted: 2017-10-18T11:43:35-07:00
by minhtran
Thank you so much Sir for all of your helps. ImageMagick is great and I learn to appreciate it a lot. I was able to make it work on window command and cygwin bash. However , I would like to ask one more help if you would not mind. I have n 1960 or 1970 newspaper articles in pdf , and as we could imagine those 60's and 70's newspapers articles are not in good quality. The only thing that visible to human eye is the headline of the article which is in big print compared to the body text of the article.Tthe body of the article is blurry. Since I am a newbie, May I ask if we could use ImageMagick to improve reading quality such as increasing density , quality , resize , ete?
I have the following code and I tried what I have learned from the forum but I am a newbie and need to gain more experiences in order to understand and to use all of our ImageMagick commands fully. So I may have missed some important commands which may help to increase the visibility.

for file in `ls *.pdf`; do
convert -verbose -colorspace RGB -resize 800 -interlace JPEG -density 1000 -quality 5080 $file `echo $file | sed 's/\.pdf$/\.jpg/'`
done


Thanks again for all of the wonderful helps!

Re: re: Install ImageMagick on window

Posted: 2017-10-18T12:11:31-07:00
by fmw42
Post an example PDF to some free hosting service that does not change the format (such as to dropbox.com) or zip the file. Then put the URL here so we can see what is the problem.

What is your exact version of ImageMagick. Using -colorspace RGB will make the image darker if on a current version of ImageMagick. On older versions of ImageMagick RGB and SRGB were swapped and so using RGB would have been correct.

Proper IM 6 syntax for converting PDF to jpg would be to set the density and colorspace before reading the PDF, then resize, then set the JPG arguments afterwards and before writing the output JPG file.

Re: re: Install ImageMagick on window

Posted: 2017-10-18T12:39:46-07:00
by minhtran
Thank you so much. My ImageMagick version is 7.0.7 Q16 (64 bits).

I have attached the 1960's PDF file and the JPG file which I did converse from PDF for you to view

PDF file : https://www.dropbox.com/s/f59qxv5ud80twci/1960.pdf?dl=0

JPG file converted from PDF : https://www.dropbox.com/s/0pqys95d2r7zovz/1960.jpg?dl=0

Regards,
Tom

Re: re: Install ImageMagick on window

Posted: 2017-10-18T13:16:04-07:00
by fmw42
Your PDF seems to be a low quality scan (scanned at low density) of binary data (newspaper page). Thus you have a raster images enclosed in a vector shell. I do not think there is any way to recover a better quality that just from the raster data inside the PDF shell.

You can get a little better quality by extracting the raster data from the PDF shell using pdfimages:

Code: Select all

pdfimages -png 1960.pdf ./

Re: re: Install ImageMagick on window

Posted: 2017-10-18T13:24:44-07:00
by minhtran
Thank you so much. I at least now know the problem with a low quality scan. May I ask if I could use a higher quality scan, would it resulted into a lesser raster scan problem ? I am going to extract the raster data now in combination of what you have suggested earlier of setting up density and colorspace before reading the PDF . May I ask if is it ok if I set density to 1000 and colorspace of RGB on my IM version 7? Also may I convert the pdf to tif so it mayhelp to improve the reading quality ?

Many thanks!!

Re: re: Install ImageMagick on window

Posted: 2017-10-18T15:06:26-07:00
by fmw42
If you rescan the page and use a larger density, it would come out much better.

You can set the density to 1000 in ImageMagick but that may be overkill. Set the density to whatever works without having to do a resize.

In IM 7 use magick rather than convert. Also use -colorspace sRGB.

Converting to tiff or png might help some in resulting quality, but will give much larger file sizes.

Re: re: Install ImageMagick on window

Posted: 2017-10-19T05:58:40-07:00
by minhtran
Thank you so much for all of your helps. I am going to try them all and then find out the results.

Re: re: Install ImageMagick on window

Posted: 2017-10-19T10:13:56-07:00
by minhtran
May I ask one quick question please regarding the pdfimages comment in
pdfimages -png 1960.pdf ./


I execute the comment but it said pdfimages not found. May I ask what do I need to download in order to execute the pdfimages command?

Many Thanks!!

Re: re: Install ImageMagick on window

Posted: 2017-10-19T10:18:53-07:00
by fmw42
See https://en.wikipedia.org/wiki/Pdfimages. I do not know if it is available for Windows.

Re: re: Install ImageMagick on window

Posted: 2017-10-19T10:24:31-07:00
by minhtran
Thank you so much. I am going to run it on my virtual box.

Re: re: Install ImageMagick on window

Posted: 2017-10-19T11:14:28-07:00
by minhtran
Thanks. I was able to run the pdfimages -png 1960.pdf ./ from my virtual box. I have one question regarding saving pdf file after I remove the raster scan from it. Would it be correct if pdfimages -png 1960.pdf ./ remove the raster scan and save it back as the 1960.pdf ? or in case if it could not save it back to the same file name pdf, would the pdfimages -png 1960.pdf 1960V1.pdf ./ do the job under new file name 1960V1.pdf?
Many Thanks!!