diff --git a/src/sfs/wadcvt.dpr b/src/sfs/wadcvt.dpr
index af1f8d527845c68afde2fd687790a7c8e8f9bdf6..8d02803a8f82b23e903da72fc57113ffe7fda427 100644 (file)
--- a/src/sfs/wadcvt.dpr
+++ b/src/sfs/wadcvt.dpr
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
{$MODE OBJFPC}
{$IFDEF WINDOWS}
{$APPTYPE CONSOLE}
optConvertATX: Boolean = false;
optConvertTGA: Boolean = false;
optLoCaseNames: Boolean = false;
+ optAggressivePng: Boolean = false;
+ optRecompress: Boolean = false;
function convertAnimTexture (wadSt: TStream; wadName: AnsiString): TMemoryStream;
sto := TMemoryStream.Create();
//writeln(' ... [', ChangeFileExt(wadName, '.png'), '] (', length(ia), ') ');
+ Imaging.SetOption(ImagingPNGCompressLevel, 9);
+ if optAggressivePng then Imaging.SetOption(ImagingPNGPreFilter, 6);
if SaveMultiImageToStream('png', sto, ia) then
begin
sto.position := 0;
try
GlobalMetadata.CopyLoadedMetaItemsForSaving;
sto := TMemoryStream.Create();
+ Imaging.SetOption(ImagingPNGCompressLevel, 9);
+ if optAggressivePng then Imaging.SetOption(ImagingPNGPreFilter, 6);
if SaveMultiImageToStream('png', sto, ia) then
begin
sto.position := 0;
Halt(1);
end;
+ Imaging.SetOption(ImagingPNGCompressLevel, 9);
+ Imaging.SetOption(ImagingPNGLoadAnimated, 1);
+ Imaging.SetOption(ImagingGIFLoadAnimated, 1);
+
for f := 1 to ParamCount() do
begin
arg := ParamStr(f);
else if arg = '--tga' then optConvertTGA := true
else if arg = '--locase' then optLoCaseNames := true
else if arg = '--nocase' then optLoCaseNames := false
+ else if arg = '--aggressive' then begin optAggressivePng := true; Imaging.SetOption(ImagingPNGPreFilter, 6); end
+ else if arg = '--recompress' then optRecompress := true
else if (arg = '--help') or (arg = '-h') then
begin
writeln('usage: wadcvt [options] file.wad');
Halt(1);
end;
- Imaging.SetOption(ImagingPNGCompressLevel, 9);
- Imaging.SetOption(ImagingPNGLoadAnimated, 1);
- Imaging.SetOption(ImagingGIFLoadAnimated, 1);
-
{$IFNDEF WINDOWS}
optLoCaseNames := true;
{$ENDIF}
{$ENDIF}
end;
end
- else if optConvertTGA and (StrEquCI1251(ExtractFileExt(newname), '.tga') or StrEquCI1251(ExtractFileExt(newname), '.bmp')) then
+ else if optRecompress or (optConvertTGA and (StrEquCI1251(ExtractFileExt(newname), '.tga') or StrEquCI1251(ExtractFileExt(newname), '.bmp'))) then
begin
ast := recompressImageToPng(fs);
if ast <> nil then
newname := fl[f].fPath+newname;
if optLoCaseNames then for c := 1 to length(newname) do newname[c] := LoCase1251(newname[c]);
nfo := ZipOne(fo, newname, fs);
- write('DONE');
+ write(nfo.pksize, ' DONE');
{$IFNDEF ONELINELOG}
writeln;
{$ENDIF}