Resizing a very large image (complete newbie).

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
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Resizing a very large image (complete newbie).

Post by Deixus »

When it comes to computer stuff, I used to be on my game back in the '90s or so. I am very computer illiterate these days, it took me an hour just to figure out how to open the Windows 10 command prompt. I've tried reading the tutorial pages for ImageMagick but I don't understand *anything* of what I am reading. When I try to copy paste commands, all I get is errors and I can't tell from them what I'm doing wrong. For all intends and purposes, treat me like a five-year old.

I'll keep this to the point.

I have a 1 GB file named 1.png that I can't even open in anything due to its size. I need to convert it to a more workable size like 4000 x 4000. I know this requires a lot of memory and disc space, but I'll try to make a little more room if I can.

Computer specs:
Windows 10 64 bit Pro OEM
i7-4820K @ 3.7 Ghz
16 GB RAM
80 GB of free space left on my primary (only) hard drive, which is an SSD.

For convenience sake, I put 1.png in the main imagemagick directory, C:\Program Files\ImageMagick\

What do I write in the Windows Command Prompt to convert the image to 4000x4000? :?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resizing a very large image (complete newbie).

Post by snibgo »

What version of IM are you using? (At the command prompt, type "convert -version" and paste the results here.)

How many pixels does your 1.png file contain? Is it colour or grayscale?

IM v6 needs 8 bytes of memory per pixel (plus some overhead for the overall image). If you don't have enough real memory, it will use disk. For example, if you have 100 million pixels, you need 800 million bytes, nearly 1 GB.

The command could be:

Code: Select all

convert 1.png -resize 4000x4000 out.png
But if you are using v7, it could be:

Code: Select all

magick 1.png -resize 4000x4000 out.png
snibgo's IM pages: im.snibgo.com
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

I think the version is 7.0.3-4, but the changelog text file is a little hard to read because it doesn't seem to use word wrap. I know the version number was in the folder name, but I simplified it because it was hard to type out in the prompt.

Code: Select all

C:\Program Files\ImageMagick>convert 1.png -resize 4000x4000 out.png
Invalid Parameter - -resize

C:\Program Files\ImageMagick>magick 1.png -resize 4000x4000 out.png
magick: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/715.
magick: UnableToOpenConfigureFile `delegates.xml' @ warning/configure.c/GetConfigureOptions/715.
magick: UnableToOpenModuleFile 'C:\Program Files\ImageMagick-7.0.3-Q16\modules\coders\IM_MOD_RL_PNG_.dll': No such file or directory @ warning/module.c/GetMagickModulePath/680.
magick: NoDecodeDelegateForThisImageFormat `PNG' @ error/constitute.c/ReadImage/508.
magick: NoImageForProperty "%w" @ warning/property.c/GetMagickPropertyLetter/2550.
magick: UnknownImageProperty "%w" @ warning/property.c/InterpretImageProperties/3488.
magick: NoImageForProperty "%h" @ warning/property.c/GetMagickPropertyLetter/2438.
magick: UnknownImageProperty "%h" @ warning/property.c/InterpretImageProperties/3488.
magick: NoImageForProperty "%m" @ warning/property.c/GetMagickPropertyLetter/2469.
magick: UnknownImageProperty "%m" @ warning/property.c/InterpretImageProperties/3488.
I'm guessing convert already is a DOS command.

I don't know how many pixels the image has, just that it is about 1 GB. The image is computer generated and I know the colours at least have to be *somewhat* limited. Maybe more than 256, less than photo realism. I don't know if the colour map was optimized. I don't really know anything about the state or quality of the image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing a very large image (complete newbie).

Post by fmw42 »

C:\Program Files\ImageMagick>convert 1.png -resize 4000x4000 out.png
Invalid Parameter - -resize
I believe that this implies that you are using the Window convert.exe rather than the IM convert.exe. Many people change the name of the IM version.

What do you get from:

convert -version

Perhaps since you are on IM 7, you should be using the new syntax and not the legacy syntax. You may never have installed the legacy option when you install IM 7. So try

Code: Select all

magick 1.png -resize 4000x4000 out.png
and

Code: Select all

magick -version
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

fmw42 wrote:
Perhaps since you are on IM 7, you should be using the new syntax and not the legacy syntax. You may never have installed the legacy option when you install IM 7. So try

Code: Select all

magick 1.png -resize 4000x4000 out.png
and

Code: Select all

magick -version
Read my last post again, the result is in the quote also.

I tried the version command also and it rolled out "7.0.3-4 Q16 x64".
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resizing a very large image (complete newbie).

Post by snibgo »

C:\Program Files\ImageMagick>magick 1.png -resize 4000x4000 out.png
magick: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/715.
Those warnings, unable to open xml files, should not occur.
snibgo's IM pages: im.snibgo.com
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

Yet they do?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resizing a very large image (complete newbie).

Post by snibgo »

Yes. I don't know why you have those warnings. But they suggest a major problem that needs fixing.

I suggest you try "-debug", eg:

Code: Select all

magick -debug configure rose: NULL:
The output should include lines like this:

Code: Select all

:
:
  Searching for configure file: "C:\im\ImageMagick-7.0.2-5-Q16\delegates.xml"
2016-10-15T02:16:46+01:00 0:00.109 0.016u 7.0.2 Configure magick[5168]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "C:\Users\Alan\AppData\Local\ImageMagick\delegates.xml"
2016-10-15T02:16:46+01:00 0:00.109 0.016u 7.0.2 Configure magick[5168]: delegate.c/LoadDelegateCache/2015/Configure
  Loading delegate configuration file "C:\im\ImageMagick-7.0.2-5-Q16\delegates.xml" ...
:
:
  Searching for configure file: "C:\im\ImageMagick-7.0.2-5-Q16\magic.xml"
2016-10-15T02:16:46+01:00 0:00.219 0.016u 7.0.2 Configure magick[5168]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "C:\Users\Alan\AppData\Local\ImageMagick\magic.xml"
2016-10-15T02:16:46+01:00 0:00.234 0.016u 7.0.2 Configure magick[5168]: magic.c/LoadMagicCache/853/Configure
  Loading magic configure file "C:\im\ImageMagick-7.0.2-5-Q16\magic.xml" ...
Your "loading" is failing, so you may get messages saying why it is failing.

You say:
Deixus wrote:I know the version number was in the folder name, but I simplified it because it was hard to type out in the prompt.
This might be the cause of the problem. What exactly did you "simplify"? If you specified a different directory during installation, that should work fine. But if you installed to one directory then changed the directory name without also editing the registry, IM will look for its XML files in the wrong place.
snibgo's IM pages: im.snibgo.com
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

Ah, I see your point. I should have realized that from the error message. I'll restore it to the former name.
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

Now I get this. I guess I just don't have enough space on my machine. Wish there was some way to view or resize it, I don't even need that much detail.

Code: Select all

C:\Program Files\ImageMagick-7.0.3-Q16>magick 1.png -resize 4000x4000 out.png
magick: unable to extend cache '1.png': No space left on device @ error/cache.c/OpenPixelCache/3609.
magick: no image to apply a property "%w" @ warning/property.c/GetMagickPropertyLetter/2550.
magick: unknown image property "%w" @ warning/property.c/InterpretImageProperties/3488.
magick: no image to apply a property "%h" @ warning/property.c/GetMagickPropertyLetter/2438.
magick: unknown image property "%h" @ warning/property.c/InterpretImageProperties/3488.
magick: no image to apply a property "%m" @ warning/property.c/GetMagickPropertyLetter/2469.
magick: unknown image property "%m" @ warning/property.c/InterpretImageProperties/3488.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resizing a very large image (complete newbie).

Post by snibgo »

The command...

Code: Select all

identify 1.png
... should tell you how many pixels the image has, eg 12345x23456.

I think it is likely your computer doesn't enough memory or disk. Beg, borrow or steal a bigger computer.
snibgo's IM pages: im.snibgo.com
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

Code: Select all

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Program Files\ImageMagick-7.0.3-Q16>magick identify 1.png
1.png PNG 327168x325632 327168x325632+0+0 8-bit sRGB 1.0255GB 0.000u 0:00.000
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resizing a very large image (complete newbie).

Post by snibgo »

Yeah, that is 107 giga-pixels. Get a bigger computer.
snibgo's IM pages: im.snibgo.com
Deixus
Posts: 8
Joined: 2016-10-13T01:39:22-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by Deixus »

ohkay. :T
rimkashox
Posts: 1
Joined: 2016-10-24T06:54:03-07:00
Authentication code: 1151

Re: Resizing a very large image (complete newbie).

Post by rimkashox »

Hey folks, just wanted to signal that I'm getting the same warning as above on IM 7.0.3-4 using a buildpack on heroku.

"app[worker.1]: mogrify: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/715."

However, the image resizing seems to work ok. But surely it's not normal that this file is unable to open. Maybe it's something to do with this particular release 7.0.3-4.
Post Reply