Page 1 of 2

Error when converting lots in JPG in BATCH

Posted: 2018-04-05T21:40:15-07:00
by mikarts
Morning.
I use a batch archive for resizing lots of JPG. This works:

Code: Select all

for %%F in (*.JPG) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/JPG ORIGINAL"
    convert "%%F" -resize 1500x1000 -strip -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
    move "%%F" "%%C-%%B-%%A/JPG ORIGINAL"
  )
)
But when and I try to not strip the image information it crashes:

Code: Select all

for %%F in (*.JPG) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/JPG ORIGINAL"
    convert "%%F" -resize 1500x1000 -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
    move "%%F" "%%C-%%B-%%A/JPG ORIGINAL"
  )
)
There is only the difference -strip

I have this trouble from a long time.
I have tried with several versions, at least from the 6.9.2, and just now with the
7.0.7-28-Q8-x64
7.0.7-28-Q16-x64
I am working on windos 10 x64

Could someone help me?
Many thanks.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-05T21:56:00-07:00
by snibgo
mikarts wrote:it crashes
What crashes? What error message do you get?

Can you isolate the problem to a single "convert" command, on a single file, with no variables like %%C. Then we can investigate.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-05T22:09:41-07:00
by mikarts
Sorry, I have now more information.
This code is part of a batch which classifies different kind of archives, like PSD, DNG, MOV, etc.
If I isolate this code in a single BATCh everything works. The trouble appears when it is in the full BATCH I copy now its code:

Code: Select all

REM JPG CLASIFICA Y COMPRIME A 90
for %%F in (*.JPG) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/JPG ORIGINAL"
    convert "%%F" -resize 1500x1000 -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
    move "%%F" "%%C-%%B-%%A/JPG ORIGINAL"
  )
)
REM PSD
for %%F in (*.PSD) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/PSD"
    move "%%F" "%%C-%%B-%%A/PSD"
  )
)
REM RAW
for %%F in (*.NEF) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/DNG"
    move "%%F" "%%C-%%B-%%A/DNG"
  )
)
for %%F in (*.CR2) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/DNG"
    move "%%F" "%%C-%%B-%%A/DNG"
  )
)
for %%F in (*.DNG) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/DNG"
    move "%%F" "%%C-%%B-%%A/DNG"
  )
)
REM VÍDEOS
for %%F in (*.MOV) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/MOV"
    move "%%F" "%%C-%%B-%%A/MOV"
  )
)
for %%F in (*.3GP) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/3GP"
    move "%%F" "%%C-%%B-%%A/3GP"
  )
)
for %%F in (*.MP4) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/MP4"
    move "%%F" "%%C-%%B-%%A/MP4"
  )
)
for %%F in (*.MTS) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/MTS"
    move "%%F" "%%C-%%B-%%A/MTS"
  )
)
for %%F in (*.AVI) do (
  for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
    md "%%C-%%B-%%A"
    md "%%C-%%B-%%A/AVI"
    move "%%F" "%%C-%%B-%%A/AVI"
  )
)
del Convert.bat
The error is (in spanish):
Procesador de comandos de Windows
Procesador de comandos de Windows dejó de funcionar
El programa dejó de funcionar correctamente por un problema. Windows cerrará el programa y le notificará si existe una solución.
Cerrar programa

The last is a button. When I press it directly closes the DOS Window.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-05T22:34:48-07:00
by snibgo
That isn't an error from ImageMagick, but a generic Windows message that something fatal has happened. Does this happen with all JPEGs? Or just large ones?

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-05T23:03:32-07:00
by mikarts
Thank you.
It happens with all JPG.

I do not why, but if you change the line
convert "%%F" -resize 1500x1000 -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
by this other
convert "%%F" -resize 1500x1000 -strip -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
The bat works till the end. Never crashes.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-05T23:10:50-07:00
by fmw42
Your profiles and other meta data may be very large or corrupt and so needs to be stripped.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T00:10:38-07:00
by snibgo
Please post a link to an example JPEG that gives the problem.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T00:12:51-07:00
by mikarts
I have tried with stripped JPGs an remains without working.
And this works in a single .bat:
for %%F in (*.JPG) do (
for /f "tokens=1-3 delims=/ " %%A in ("%%~tF") do (
md "%%C-%%B-%%A"
md "%%C-%%B-%%A/JPG ORIGINAL"
convert "%%F" -resize 1500x1000 -strip -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
move "%%F" "%%C-%%B-%%A/JPG ORIGINAL"
)
)
The trouble appears when you add the other parts of the batch and only with the strip.
I cannot understand why.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T00:13:47-07:00
by mikarts
In my experience any JPG gives the problem.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T00:15:58-07:00
by mikarts
In my experience any JPG gives the problem.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T00:38:19-07:00
by snibgo
What command fails?

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T01:05:55-07:00
by mikarts
mikarts wrote: 2018-04-05T23:03:32-07:00 Thank you.
It happens with all JPG.

I do not why, but if you change the line
convert "%%F" -resize 1500x1000 -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
by this other
convert "%%F" -resize 1500x1000 -strip -quality 90 -interlace plane "%%C-%%B-%%A/%%F"
The bat works till the end. Never crashes.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T01:26:07-07:00
by snibgo
Yes, but how far does the batch file get when the failure happens?

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T01:38:21-07:00
by mikarts
The bat works creatting the directories and moving the archives different of JPG to its directory. Then batch crashes when it tries to convert the first JPG.

Re: Error when converting lots in JPG in BATCH

Posted: 2018-04-06T08:44:53-07:00
by fmw42
Perhaps update your libjpeg delegate.