convert: NoImagesDefined

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?".
Locked
HenrikoMagnifico
Posts: 5
Joined: 2020-02-18T16:08:24-07:00
Authentication code: 1152

convert: NoImagesDefined

Post by HenrikoMagnifico »

Hi! I'm trying to conver the alpha of one set of images to another set of the same but upscaled set of images using ImageMagik on Windows 10. The command I'm trying to use is this;

Code: Select all

for /r %%i in (.\A\*) do convert -quiet A\%%~nxi ( B\%%~nxi -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\%%~nxi
pause
I'm using the method of another user on Reddit "Hairlesswookie" in a post made here: https://www.reddit.com/r/GameUpscale/co ... a_channel/.

Summarized:
Create three subdirectories named "A", "B", "C" in the ImageMagick folder. Desired RGBs go in A, desired alphas go in B. Merged output will end up in C. Then use the following batch file:

Code: Select all

for /r %%i in (.\A\*) do convert -quiet A\%%~nxi ( B\%%~nxi -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\%%~nxi
pause
The RGB and matching A files need the same filenames (hence different sub-folders).
However, when launching the .bat file it spits out a ton of error messages that looks like this;

Code: Select all

C:\Users\henri\Desktop\ImageMagick-7.0.9-Q16>convert -quiet A\tex1_128x128_07EF1A3A49B623D0_12.png ( B\tex1_128x128_07EF1A3A49B623D0_12.png -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\tex1_128x128_07EF1A3A49B623D0_12.png
convert: NoDecodeDelegateForThisImageFormat `PNG' @ error/constitute.c/ReadImage/562.
convert: NoDecodeDelegateForThisImageFormat `PNG' @ error/constitute.c/ReadImage/562.
convert: NoImagesDefined `C\tex1_128x128_07EF1A3A49B623D0_12.png' @ error/convert.c/ConvertImageCommand/3273.

C:\Users\henri\Desktop\ImageMagick-7.0.9-Q16>convert -quiet A\tex1_128x128_0831D4FBB5C9E11A_13.png ( B\tex1_128x128_0831D4FBB5C9E11A_13.png -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\tex1_128x128_0831D4FBB5C9E11A_13.png
I have tried moving ImageMagik folder out of the Program Files directory onto my desktop and then launching the .bat file but it's still giving me the same error. I'm a beginner so I'm completely lost on how to fix this! Any help would be very much appreciated.

Cheers!
Henrik

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert: NoImagesDefined

Post by fmw42 »

For Imagemagick 7, use magick not convert. Convert calls IM 6 and if you have not installed the legacy components on Windows, then IM 6 convert will be missing.

What do you get from

Code: Select all

magick -version
Does it list png? If not, then you have not installed the PNG delegate library or did not install from binary. I do not think you can just move the Imagemagick install. However, I do not use Windows and will leave confirmation and other comments to the Windows users of Imagemagick.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: convert: NoImagesDefined

Post by snibgo »

HenrikoMagnifico wrote:C:\Users\henri\Desktop\ImageMagick-7.0.9-Q16>convert ...
I expect that's the problem. You installed ImageMagick to a directory, but then moved that directory to your desktop, and now IM can't find its own files.

If you really want IM to reside in a directory on your desktop, re-install IM and give that as your installation directory. But I think that's a bad idea.

I suggest you delete the IM files, then re-install IM, in a directory under "Program Files" or similar. Also tick the box that adds that directory to your system path.
snibgo's IM pages: im.snibgo.com

HenrikoMagnifico
Posts: 5
Joined: 2020-02-18T16:08:24-07:00
Authentication code: 1152

Re: convert: NoImagesDefined

Post by HenrikoMagnifico »

fmw42 wrote:
2020-02-18T16:30:24-07:00
For Imagemagick 7, use magick not convert. Convert calls IM 6 and if you have not installed the legacy components on Windows, then IM 6 convert will be missing.

What do you get from

Code: Select all

magick -version
Does it list png? If not, then you have not installed the PNG delegate library or did not install from binary. I do not think you can just move the Imagemagick install. However, I do not use Windows and will leave confirmation and other comments to the Windows users of Imagemagick.
Thanks for your response! I am using the latest version of ImageMagik, so ImageMagik 7.0.9. I initially installed it in Program Files, the default directory, and I also checked the "Install legacy components" box. However, it didn't seem to work. I only moved it outside to see if that would work, which it didn't either.

I tried running magic -version and it gives me this;

Code: Select all

C:\Users\henri>"C:\Program Files\ImageMagick-7.0.9-Q16\magick.exe" -version
Version: ImageMagick 7.0.9-24 Q16 x64 2020-02-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib
PNG does appear in the list, so I presume I'm not missing any delegates?

HenrikoMagnifico
Posts: 5
Joined: 2020-02-18T16:08:24-07:00
Authentication code: 1152

Re: convert: NoImagesDefined

Post by HenrikoMagnifico »

snibgo wrote:
2020-02-18T16:45:11-07:00
HenrikoMagnifico wrote:C:\Users\henri\Desktop\ImageMagick-7.0.9-Q16>convert ...
I expect that's the problem. You installed ImageMagick to a directory, but then moved that directory to your desktop, and now IM can't find its own files.

If you really want IM to reside in a directory on your desktop, re-install IM and give that as your installation directory. But I think that's a bad idea.

I suggest you delete the IM files, then re-install IM, in a directory under "Program Files" or similar. Also tick the box that adds that directory to your system path.
I have now re-installed ImageMagik with the settings you recommended, now I'm getting a different error:

Code: Select all

C:\Program Files\ImageMagick-7.0.9-Q16>convert -quiet A\tex1_1024x256_F010ABC3EF3BF6A1_12.png ( B\tex1_1024x256_F010ABC3EF3BF6A1_12.png -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\tex1_1024x256_F010ABC3EF3BF6A1_12.png
convert: unable to open image 'C\tex1_1024x256_F010ABC3EF3BF6A1_12.png': Permission denied @ error/blob.c/OpenBlob/3496.
convert: WriteBlob Failed `C\tex1_1024x256_F010ABC3EF3BF6A1_12.png' @ error/png.c/MagickPNGErrorHandler/1715.

C:\Program Files\ImageMagick-7.0.9-Q16>convert -quiet A\tex1_128x128_00358F86CC283BB6_12.png ( B\tex1_128x128_00358F86CC283BB6_12.png -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\tex1_128x128_00358F86CC283BB6_12.png
convert: unable to open image 'C\tex1_128x128_00358F86CC283BB6_12.png': Permission denied @ error/blob.c/OpenBlob/3496.
convert: WriteBlob Failed `C\tex1_128x128_00358F86CC283BB6_12.png' @ error/png.c/MagickPNGErrorHandler/1715.
...this occurs when I try to run the .bat file without right clicking it and then "Run as Administrator".

When I try to run the .bat file as an administrator however, it simply gives me this and then stops:

Code: Select all

C:\WINDOWS\system32>for /R %i in (.\A\*) do convert -quiet A\%~nxi ( B\%~nxi -channel a -separate +channel ) -alpha off -compose copy_opacity -composite C\%~nxi

C:\WINDOWS\system32>pause
Press any key to continue . . .
Any idea what might be the cause?

Thanks for your help!

Cheers
Last edited by HenrikoMagnifico on 2020-02-19T07:46:37-07:00, edited 1 time in total.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: convert: NoImagesDefined

Post by snibgo »

HenrikoMagnifico wrote:convert: unable to open image 'C\tex1_1024x256_F010ABC3EF3BF6A1_12.png': Permission denied @ error/blob.c/OpenBlob/3496.
The operating system isn't giving you permission to open the file. What happens when you type just "C\tex1_1024x256_F010ABC3EF3BF6A1_12.png" (no quotes) at the command line? Does it show you the image, or say you don't have permission?

If the problem is OS permission, then icacls will probably fix it. In that directory, type...

Code: Select all

icacls * /grant Alan:F
... but use your own username instead of "Alan".
snibgo's IM pages: im.snibgo.com

HenrikoMagnifico
Posts: 5
Joined: 2020-02-18T16:08:24-07:00
Authentication code: 1152

Re: convert: NoImagesDefined

Post by HenrikoMagnifico »

snibgo wrote:
2020-02-19T09:19:48-07:00
HenrikoMagnifico wrote:convert: unable to open image 'C\tex1_1024x256_F010ABC3EF3BF6A1_12.png': Permission denied @ error/blob.c/OpenBlob/3496.
The operating system isn't giving you permission to open the file. What happens when you type just "C\tex1_1024x256_F010ABC3EF3BF6A1_12.png" (no quotes) at the command line? Does it show you the image, or say you don't have permission?

If the problem is OS permission, then icacls will probably fix it. In that directory, type...

Code: Select all

icacls * /grant Alan:F
... but use your own username instead of "Alan".
Thanks for your response!

I think I may have explained poorly, the A, B and C folders respectively are located inside the ImageMagik folder. The idea is that the RGB from the images in folder A will be merged with the alpha from folder B and then the result would be exported in folder C.

Folder C is empty by default, so I can not do any checks on any files in folder C.

However, using the command in Folder A or folder B instead of C does indeed display the image in the Windows image viewer.

Cheers!

HenrikoMagnifico
Posts: 5
Joined: 2020-02-18T16:08:24-07:00
Authentication code: 1152

Re: convert: NoImagesDefined

Post by HenrikoMagnifico »

Update: I got it working! I simply edited the .bat script so that it could run in the command promt standalone by removing the second '%' everywhere and now it's not giving me any errors.

Thanks for your help!

Locked