Page 2 of 2

Re: Folder empty on Windows

Posted: 2017-06-01T20:03:33-07:00
by fmw42
So just remove the variables and paths and put in actual dimensions and file names for files in your home directory. See if that works.

Code: Select all

magick.exe yourimage.png -crop 256x256 -set filename:tile "%%[fx:page.x/256]_%%[fx:page.y/256]" +repage +adjoin "tile-%%[filename:tile].png"

Re: Folder empty on Windows

Posted: 2017-06-01T20:12:30-07:00
by luangs7
snibgo wrote: 2017-06-01T20:02:44-07:00 What is the first command that fails? What is the error message?

You should then try that command in the command window. What happens then?

For example, the first IM command seems to be:

Code: Select all

%imagemagick% %filename% -resize 50%% %basename%-500.%extension%
Substituting the variables, and changing %% to %:

Code: Select all

magick my-image.jpg -resize 50% my_image_base_name-500.jpg
Does that command work? If not what is the error message? If it is "UnableToOpenConfigureFile" then you haven't installed IM properly.

Code: Select all

%imagemagick% %filename% -resize 50%  %basename%-500.%extension%
magick.exe: unable to open image 'my-image.jpg': No such file or directory @ error/blob.c/OpenBlob/3094.
magick.exe: no image to apply a property "%w" @ warning/property.c/GetMagickPropertyLetter/2561.
magick.exe: unknown image property "%w" @ warning/property.c/InterpretImageProperties/3499.
magick.exe: no image to apply a property "%h" @ warning/property.c/GetMagickPropertyLetter/2449.
magick.exe: unknown image property "%h" @ warning/property.c/InterpretImageProperties/3499.
magick.exe: no image to apply a property "%m" @ warning/property.c/GetMagickPropertyLetter/2480.
magick.exe: unknown image property "%m" @ warning/property.c/InterpretImageProperties/3499.
%imagemagick% %filename% -resize 25%  %basename%-250.%extension%
magick.exe: unable to open image 'my-image.jpg': No such file or directory @ error/blob.c/OpenBlob/3094.
magick.exe: no image to apply a property "%w" @ warning/property.c/GetMagickPropertyLetter/2561.
magick.exe: unknown image property "%w" @ warning/property.c/InterpretImageProperties/3499.
magick.exe: no image to apply a property "%h" @ warning/property.c/GetMagickPropertyLetter/2449.
magick.exe: unknown image property "%h" @ warning/property.c/InterpretImageProperties/3499.
magick.exe: no image to apply a property "%m" @ warning/property.c/GetMagickPropertyLetter/2480.
magick.exe: unknown image property "%m" @ warning/property.c/InterpretImageProperties/3499.
%imagemagick% %filename% -resize 12.5%  %basename%-125.%extension%
magick.exe: unable to open image 'my-image.jpg': No such file or directory @ error/blob.c/OpenBlob/3094.
magick.exe: no image to apply a property "%w" @ warning/property.c/GetMagickPropertyLetter/2561.
magick.exe: unknown image property "%w" @ warning/property.c/InterpretImageProperties/3499.
magick.exe: no image to apply a property "%h" @ warning/property.c/GetMagickPropertyLetter/2449.
magick.exe: unknown image property "%h" @ warning/property.c/InterpretImageProperties/3499.
magick.exe: no image to apply a property "%m" @ warning/property.c/GetMagickPropertyLetter/2480.
magick.exe: unknown image property "%m" @ warning/property.c/InterpretImageProperties/3499.

same error with "%" and "%%"

Re: Folder empty on Windows

Posted: 2017-06-01T20:29:26-07:00
by fmw42
Snibgo said to run

magick my-image.jpg -resize 50% my_image_base_name-500.jpg

not with variables.

Re: Folder empty on Windows

Posted: 2017-06-01T20:32:28-07:00
by snibgo
unable to open image 'my-image.jpg'
This is the input image for the process. So, does that file exist?

Re: Folder empty on Windows

Posted: 2017-06-02T07:28:03-07:00
by luangs7
snibgo wrote: 2017-06-01T20:02:44-07:00 What is the first command that fails? What is the error message?

You should then try that command in the command window. What happens then?

For example, the first IM command seems to be:

Code: Select all

%imagemagick% %filename% -resize 50%% %basename%-500.%extension%
Substituting the variables, and changing %% to %:

Code: Select all

magick my-image.jpg -resize 50% my_image_base_name-500.jpg
Does that command work? If not what is the error message? If it is "UnableToOpenConfigureFile" then you haven't installed IM properly.

Hey, now I'm on Mac in my work
magick image.png -resize 50% my_image_base_name-500.png
works like a charm here.


So, about this command:

Code: Select all

echo should already have original image in folder, as well as folders named tiles and samples

set basename=my_image_base_name
set filename=my-image.jpg
set extension=jpg

set imagemagick=C:\path\to\ImageMagick\convert
set /a tilesize=256
set /a samplesize=500

set tilesfolder=tiles
set samplesfolder=samples

echo create tile folders
mkdir %tilesfolder%\%basename%
mkdir %tilesfolder%\%basename%\1000
mkdir %tilesfolder%\%basename%\500
mkdir %tilesfolder%\%basename%\250
mkdir %tilesfolder%\%basename%\125

echo create half-sized versions for tiling (will be discarded later)
%imagemagick% %filename% -resize 50%%  %basename%-500.%extension%
%imagemagick% %filename% -resize 25%%  %basename%-250.%extension%
%imagemagick% %filename% -resize 12.5%%  %basename%-125.%extension%

echo create sample
%imagemagick% %filename% -thumbnail %samplesize%x%samplesize%  ./%samplesfolder%/%filename%

echo create tiles
%imagemagick% %filename% -crop %tilesize%x%tilesize% -set filename:tile "%%[fx:page.x/%tilesize%]_%%[fx:page.y/%tilesize%]" +repage +adjoin "./%tilesfolder%/%basename%/1000/%%[filename:tile].%extension%"
%imagemagick% %basename%-500.%extension% -crop %tilesize%x%tilesize% -set filename:tile "%%[fx:page.x/%tilesize%]_%%[fx:page.y/%tilesize%]" +repage +adjoin "./%tilesfolder%/%basename%/500/%%[filename:tile].%extension%"
%imagemagick% %basename%-250.%extension% -crop %tilesize%x%tilesize% -set filename:tile "%%[fx:page.x/%tilesize%]_%%[fx:page.y/%tilesize%]" +repage +adjoin "./%tilesfolder%/%basename%/250/%%[filename:tile].%extension%"
%imagemagick% %basename%-125.%extension% -crop %tilesize%x%tilesize% -set filename:tile "%%[fx:page.x/%tilesize%]_%%[fx:page.y/%tilesize%]" +repage +adjoin "./%tilesfolder%/%basename%/125/%%[filename:tile].%extension%"

echo cleanup
del %basename%-500.%extension%
del %basename%-250.%extension%
del %basename%-125.%extension%

echo DONE
pause
Its the same for Mac?

Re: Folder empty on Windows

Posted: 2017-06-02T07:35:45-07:00
by luangs7
I actually run this code

Code: Select all

   echo should already have original image in folder, as well as folders named tiles and samples

    set basename=images
    set image.png=image.png
    set extension=png

    set imagemagick= magick
    set /a tilesize=256
    set /a samplesize=500

    set tilesfolder=tiles
    set samplesfolder=samples

    echo create tile folders
    mkdir tiles/samples
    mkdir tiles/samples/1000
    mkdir tiles/samples/500
    mkdir tiles/samples/250
    mkdir tiles/samples/125

    echo create half-sized versions for tiling (will be discarded later)
    magick image.png -resize 50%%  images-500.png
    magick image.png -resize 25%%  images-250.png
    magick image.png -resize 12.5%%  images-125.png

    echo create sample
    magick image.png -thumbnail 500x500  ./samples/tiles

    echo create tiles
    magick image.png -crop 256x256 -set image.png:tile "%%[fx:page.x/256]_%%[fx:page.y/256]" +repage +adjoin "./tiles/images/1000/%%[image.png:tile].png"
    magick images-500.png -crop 256x256 -set image.png:tile "%%[fx:page.x/256]_%%[fx:page.y/256]" +repage +adjoin "./tiles/images/500/%%[image.png:tile].png"
    magick images-250.png -crop 256x256 -set image.png:tile "%%[fx:page.x/256]_%%[fx:page.y/256]" +repage +adjoin "./tiles/images/250/%%[image.png:tile].png"
    magick images-125.png -crop 256x256 -set image.png:tile "%%[fx:page.x/256]_%%[fx:page.y/256]" +repage +adjoin "./tiles/images/125/%%[image.png:tile].png"

    echo cleanup
    del images-500.png
    del images-250.png
    del images-125.png

    echo DONE
    pause

But now is not creating anything

Re: Folder empty on Windows

Posted: 2017-06-02T09:38:00-07:00
by fmw42
Unix does not escape %, so use only % and not %%. What is set /a doing?

Re: Folder empty on Windows

Posted: 2017-06-02T10:10:50-07:00
by luangs7
fmw42 wrote: 2017-06-02T09:38:00-07:00 Unix does not escape %, so use only % and not %%. What is set /a doing?
Same result in Mac mate

Re: Folder empty on Windows

Posted: 2017-06-02T10:12:01-07:00
by luangs7
I simplify the code and works fine now
Maybe the problem was on create folder and set the images to them

Code: Select all

  magick image.png -resize 50%%  image-500.png
    magick image.png -resize 25%%  image-250.png
    magick image.png -resize 12.5%%  image-125.png
    magick -limit map 0 -limit memory 0 image.png -crop 256x256 -set filename:tile "%[fx:page.x/256]_%%[fx:page.y/256]" +repage +adjoin tile-%%[filename:tile].png
    magick -limit map 0 -limit memory 0 image-125.png -crop 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin tile-%[filename:tile].png
    magick -limit map 0 -limit memory 0 image-250.png -crop 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin tile-%[filename:tile].png
    magick -limit map 0 -limit memory 0 image-500.png -crop 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin tile-%[filename:tile].png

    echo cleanup
    del images-500.png
    del images-250.png
    del images-125.png [\code]