Page 1 of 1

A Bug? Output files missing extensions when filenames contain more than one period.

Posted: Mon Oct 05, 2020 7:58 am
by Maelstorm
I think I might have identified a possible bug in XnConvert. I am using XnConvert in a batch file to generate images of varying sizes. I have noticed that certain filenames are being mangled in the output. It seems that if there are multiple periods in the filename (common on image files), XnConvert gets confused about what the extension is and leaves the .png off. This is causing problems with other software that runs afterwards which loads the filenames into a MySQL database for a web application. Here's the batch that I wrote to convert the image sizes. The main baseline image size is 128x128.

Code: Select all

@ECHO OFF

SET NCONV="C:\Program Files (x86)\XnView\nconvert.exe"
SET OPTIONS=-in png -out png -ratio -rtype lanczos
SET SIZELIST=112 96 80 64 48 32
SET SETLIST=blue clear deluxe ecomm generic os oxygen people photoreal vivid
SET LOGFILE=convert.log

REM See if we are doing a clean instead.
REM Rember, the 128x128 size will not be deleted.
IF /I "%1%"=="clean" GOTO CLEAN

REM Remove previous log file.
IF EXIST %LOGFILE% ( DEL %LOGFILE% )
REM Run the size conversion.
FOR %%A IN (%SETLIST%) DO (
	IF EXIST %%A (
		FOR %%B IN (%SIZELIST%) DO (
			IF /I NOT EXIST %%A\%%B ( MKDIR %%A\%%B )
			%NCONV% %OPTIONS% -resize %%B %%B -o "%%A\%%B\%%" "%%A\128\*.png" >> %LOGFILE% 2>&1
		)
	)
)
GOTO END

REM Removes all sizes except 128x128 from all defined sets.
:CLEAN
FOR %%A IN (%SETLIST%) DO (
	IF EXIST %%A (
		FOR %%B IN (%SIZELIST%) DO (
			IF EXIST %%A\%%B ( RMDIR "%%A\%%B" /S /Q )
		)
	)
)
GOTO END


:END
ECHO Done.
In the log file, it shows that there is no .png extension even though there is one on the input. Maybe I'm missing something, but other files seem to work ok. It's just the ones that have extra periods in them that is causing problems. Below is an excerpt of the logfile that shows this:


Conversion of oxygen\128\application-vnd.rn-realmedia.png into oxygen\112\application-vnd.rn-realmedia OK
Conversion of oxygen\128\application-vnd.scribus.png into oxygen\112\application-vnd.scribus OK
Conversion of oxygen\128\application-vnd.stardivision.calc.png into oxygen\112\application-vnd.stardivision.calc OK
Conversion of oxygen\128\application-vnd.stardivision.draw.png into oxygen\112\application-vnd.stardivision.draw OK
Conversion of oxygen\128\application-vnd.stardivision.mail.png into oxygen\112\application-vnd.stardivision.mail OK
Conversion of oxygen\128\application-vnd.stardivision.math.png into oxygen\112\application-vnd.stardivision.math OK
Conversion of oxygen\128\application-vnd.sun.xml.calc.png into oxygen\112\application-vnd.sun.xml.calc OK
Conversion of oxygen\128\application-vnd.sun.xml.calc.template.png into oxygen\112\application-vnd.sun.xml.calc.template OK
Conversion of oxygen\128\application-vnd.sun.xml.draw.png into oxygen\112\application-vnd.sun.xml.draw OK
Conversion of oxygen\128\application-vnd.sun.xml.draw.template.png into oxygen\112\application-vnd.sun.xml.draw.template OK
Conversion of oxygen\128\application-vnd.sun.xml.impress.png into oxygen\112\application-vnd.sun.xml.impress OK
Conversion of oxygen\128\application-vnd.sun.xml.impress.template.png into oxygen\112\application-vnd.sun.xml.impress.template OK
Conversion of oxygen\128\application-vnd.sun.xml.math.png into oxygen\112\application-vnd.sun.xml.math OK
Conversion of oxygen\128\application-vnd.sun.xml.writer.global.png into oxygen\112\application-vnd.sun.xml.writer.global OK
Conversion of oxygen\128\application-vnd.sun.xml.writer.png into oxygen\112\application-vnd.sun.xml.writer OK
Conversion of oxygen\128\application-vnd.sun.xml.writer.template.png into oxygen\112\application-vnd.sun.xml.writer.template OK
Conversion of oxygen\128\application-vnd.wordperfect.png into oxygen\112\application-vnd.wordperfect OK

Conversion of oxygen\128\application-x-7z-compressed.png into oxygen\112\application-x-7z-compressed.png OK
Conversion of oxygen\128\application-x-abiword.png into oxygen\112\application-x-abiword.png OK
Conversion of oxygen\128\application-x-ace.png into oxygen\112\application-x-ace.png OK
Conversion of oxygen\128\application-x-applix-spreadsheet.png into oxygen\112\application-x-applix-spreadsheet.png OK


As mentioned previously, the primary size is 128x128 since all others are derived from that size. So, is this a bug or am I missing something?

Re: A Bug? Output files missing extensions when filenames contain more than one period.

Posted: Mon Oct 05, 2020 7:40 pm
by Maelstorm
I figured out a workaround for the problem. I added a .png extension to the output and now it seems to be working ok. I shouldn't have to do that though so I think there is still a bug in the program.

Re: A Bug? Output files missing extensions when filenames contain more than one period.

Posted: Tue Oct 06, 2020 10:11 am
by xnview
which settings do you use?