re: Install ImageMagick on window

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

re: Install ImageMagick on window

Post 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!!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: re: Install ImageMagick on window

Post 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
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: re: Install ImageMagick on window

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: re: Install ImageMagick on window

Post 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.
snibgo's IM pages: im.snibgo.com
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: re: Install ImageMagick on window

Post 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.
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: re: Install ImageMagick on window

Post 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 ./
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post 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!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: re: Install ImageMagick on window

Post 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.
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post by minhtran »

Thank you so much for all of your helps. I am going to try them all and then find out the results.
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post 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!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: re: Install ImageMagick on window

Post by fmw42 »

See https://en.wikipedia.org/wiki/Pdfimages. I do not know if it is available for Windows.
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post by minhtran »

Thank you so much. I am going to run it on my virtual box.
minhtran
Posts: 11
Joined: 2017-10-17T10:56:31-07:00
Authentication code: 1151

Re: re: Install ImageMagick on window

Post 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!!
Post Reply