Getting higher resolution with the montage command

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?".
Post Reply
starsandspice

Getting higher resolution with the montage command

Post by starsandspice »

I am trying to montage together two images into a single file. The command I use is:

montage -tile 2x1 file1.ps file2.ps result.ps

When I look at result.ps, though, the image is fuzzy and the text is blurred even though the input files are high resolution files.

I've tried lots of different compressions and resizing, but nothing has helped make the result.ps image clearer. Can anybody help me with this??
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Getting higher resolution with the montage command

Post by magick »

Try this command:
  • convert -density 400 file1.ps file2.ps +append -resize 25% result.ps
Keep in mind that ImageMagick rasterizes your Postscript files which may not be what you want.
starsandspice

Re: Getting higher resolution with the montage command

Post by starsandspice »

This works ok with convert - the resolution is still lower than in the input files, but at least the result is readable. Is there any way to do this within montage, though? If I add the -density 400 and -resize 25% options to my command, I get a very tiny image and I can't tell if the resolution has actually improved.

I was simplifying things a little in my first post, because I am actually montaging 15 images together in a particular sequence. I need montage because I can format the result with the -tile command. (The resolution is a problem regardless of the number of images.)

This may not be the appropriate place to ask this, but is there another software or program that will do something similar to montage but without rasterizing the postscript files?
starsandspice

Re: Getting higher resolution with the montage command

Post by starsandspice »

As an update, I tried converting my images to high resolution jpegs before using the montage command. (I used the convert command as magick recommended.) But this still results in fuzzy images! There has to be a way to use montage to combine high-resolution images, whether in jpeg or postscript, I just can't seem to figure it out.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting higher resolution with the montage command

Post by fmw42 »

JPEG is a lossy format. You need to convert them to PNG or some other format that will not loose quality due to compression and make your montage in that format, but not JPEG. Or tell IM to use -quality 100 with the JPG output.

see http://www.imagemagick.org/script/comma ... hp#quality
starsandspice

Re: Getting higher resolution with the montage command

Post by starsandspice »

Ok, I will try that.
(Clearly I'm a newbie at this; I don't usually work with image processing.)
Thanks!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Getting higher resolution with the montage command

Post by anthony »

As Magick pointed out at the begining, you may not really want to use IM at all as you are converting Postscript Images to Postscript images.

See IM Examples, A word about Vector Image Formats
http://imagemagick.org/Usage/formats/#vector
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
starsandspice

Re: Getting higher resolution with the montage command

Post by starsandspice »

You are correct, Magick did point that out, but since I don't know any alternative to using ImageMagick, I kept using it and hoping to improve the image quality. (You will note that I asked in my second post if there were alternative programs to ImageMagick for this type of processing.)

Interestingly enough, even if I convert the postscript images to high-quality jpegs and montage my images into another jpeg using "-quality 100", I still get fuzzy images. This may have to do with the "-density" command, but I'm not sure. Anyway, thank you for the link, I will take a look at VectorSection and see if I can do a montage of postscript images using that instead.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Getting higher resolution with the montage command

Post by anthony »

I gather that the images are not being resize smaller when you only use JPEG?

AT want sort of pixel sizes are the images, for both input and output?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
starsandspice

Re: Getting higher resolution with the montage command

Post by starsandspice »

The input images are 612x792. The output image are 256x126. This is if I just do a simple montage command:
montage -quality 100 inputfile1.jpg inputfile2.jpg outputfile.jpg

This confuses me because I thought that -quality 100 keeps the image resolution the same because its the least amount of compression?
Should I be resizing the images? Or doing something with -density?

Thanks!
~ M
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Getting higher resolution with the montage command

Post by anthony »

The -density of JPEG images only become involved when the image is being used on some other device that has 'real world' density.

That is -density is basically ignored (but saved) on JPEG input (though whether montage copys it to the output image is another matter). The saved value or user setting is however recorded in a JPEG output image in the standard JPEG way.

However photoshop uses its own completely separate density information that it stores in JPEG images in a photoshop specific profile. IM does not read or understand this profile.

You can see the density the IM is working with or producing using command identify -verbose
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Getting higher resolution with the montage command

Post by magick »

Anthony is correct for the most part, however, if the JPEG image includes an EXIF profile, recent versions of ImageMagick will update the resolution information in the profile.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Getting higher resolution with the montage command

Post by anthony »

Magick is this the profile that Photoshop uses?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply