Results 1 to 15 of 15

Thread: FLiF Batch File

  1. #1
    Member
    Join Date
    Aug 2008
    Location
    NZ
    Posts
    59
    Thanks
    30
    Thanked 11 Times in 7 Posts

    FLiF Batch File

    Trying to make a batch file to recursively pack png images to flif files.

    Here is the batch script -

    Code:
    FOR /R %%a IN (*.png) DO (flif -e -n %%a %%a.flif)
    Problem is that batch tries to run and partially succeeds in doing something but then get error message about flif stopped running.

    Any ideas how to get this batch file working properly, please?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	flip_error.png 
Views:	39 
Size:	22.3 KB 
ID:	7103  

  2. #2
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,828
    Thanks
    287
    Thanked 1,238 Times in 694 Posts
    Maybe try a script like this:
    Code:
    FOR /R %%a IN (*.png) DO (
      echo "%%a" >>log.txt
      flif -e -n "%%a" "%%a.flif"
    )
    In case its a problem with some specific png file, you'd see it in the log.

  3. #3
    Member
    Join Date
    Aug 2008
    Location
    NZ
    Posts
    59
    Thanks
    30
    Thanked 11 Times in 7 Posts
    Thanks for the quick reply!

    Seems like flif is having a problem with a specific png image for some reason. I'm looking into what is different about this png image compared to other pngs which were successfully compressed.

    EDIT: I've looked at one png file that flif errors out on, and there is nothing obviously different from other png files which do compress under flif.

    This file is 32 bit and highly compressed, other similar png's compress OK. But this png file seems to be mostly alpha channel, I think. Maybe this is the problem?

    Problem png attached.
    Attached Files Attached Files
    Last edited by brispuss; 27th November 2019 at 06:44.

  4. #4
    Member
    Join Date
    Aug 2008
    Location
    NZ
    Posts
    59
    Thanks
    30
    Thanked 11 Times in 7 Posts
    Still no joy?

    Attached is a png file similar in specification to the other png file. But this file (Immortal24) is successfully compressed using flif!

    Both this file (Immortal24) and the png file which fails to be compressed (21stroundblack12) are 32 bit with RGBA color space. Apart from image size and subject, the two png's seem to be identical in specification.

    So why does flif fail to compress on one file and not fail on another similar file?

    I'm really wanting to use flif to compress png images as it gives very good compression.

    Ideas?
    Attached Files Attached Files

  5. #5
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,828
    Thanks
    287
    Thanked 1,238 Times in 694 Posts
    1) My build of flif doesn't crash, but decodes a zero-size file:
    Code:
    Z:\098>flif.exe -e 21stRoundBlack12.png 1.flif
    libpng warning: iCCP: known incorrect sRGB profile
    
    Z:\098>flif.exe -d 1.flif 1.png
    libpng error: known incorrect sRGB profile
    2) It works after "convert.exe 21stRoundBlack12.png 1.png" (imagemagick)

    Maybe post an issue? https://github.com/FLIF-hub/FLIF/issues

  6. Thanks:

    brispuss (29th November 2019)

  7. #6
    Member
    Join Date
    Aug 2008
    Location
    NZ
    Posts
    59
    Thanks
    30
    Thanked 11 Times in 7 Posts
    Thanks for the tests and comment.

    Thinking about posting an "issue" at the github site, but it seems that development of flif may have stopped? So it may not be worthwhile posting the issue there.

    In the meantime I'm using different procedures to compress png images by using precomp first and then using paq8px. . or fast paq8 compressor.

    Paq8px . . compression is very slow though. So I'm currently using fpaq8 v6 which is much faster and almost provides the same compression.

  8. #7
    Member
    Join Date
    Jun 2015
    Location
    Switzerland
    Posts
    801
    Thanks
    229
    Thanked 290 Times in 172 Posts
    Quote Originally Posted by brispuss View Post
    Thanks for the tests and comment.

    Thinking about posting an "issue" at the github site, but it seems that development of flif may have stopped? So it may not be worthwhile posting the issue there.

    In the meantime I'm using different procedures to compress png images by using precomp first and then using paq8px. . or fast paq8 compressor.

    Paq8px . . compression is very slow though. So I'm currently using fpaq8 v6 which is much faster and almost provides the same compression.
    What are your thoughts on the FLIF decoding speed?

    (When I designed WebP lossless, I made quite a few density compromises to keep the pretty good decoding speed, and I'm just generally curious if the decoding speed is not an issue in your use case.)

  9. #8
    Member
    Join Date
    Aug 2008
    Location
    NZ
    Posts
    59
    Thanks
    30
    Thanked 11 Times in 7 Posts
    FLiF decoding speed?

    I haven't really paid any attention to that.

    The issue here seems to be with FLiF being unable to encode/convert some png images to flip format for whatever reason(s).

    What "speed" of encoding/decoding has anything to do with this issue is unknown.

  10. #9
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,828
    Thanks
    287
    Thanked 1,238 Times in 694 Posts
    Its an indirect suggestion to use webp lossless instead of flif:
    https://storage.googleapis.com/downl...indows-x64.zip
    cwebp.exe -z 9 -exact 21stRoundBlack12.png -o 1
    dwebp.exe -nofancy -nofilter -nodither 1 -o 2
    It seems to work on your "buggy" file and even produces a smaller output file.

  11. #10
    Member
    Join Date
    Aug 2008
    Location
    NZ
    Posts
    59
    Thanks
    30
    Thanked 11 Times in 7 Posts
    Thanks for the details!

    I was aware of webp.

    Although webp may produce smaller files with respect to flif files, decompressing/decoding webp files back is apparently not lossless(?)

    A test compression and decompression using the supplied (in previous post) webp options of the file 21dtRoundBlack21.png produced the results -

    Original png file size 15,235 bytes
    Webp compressed file size 7,116 bytes
    Decompressed webp file with size at 13,515 bytes

    So the decompressed file does not match the original file in size. This is NOT what is wanted.

    What is wanted is a decompressed file with EXACTLY the same file size as the original file.

    The png files are intended to be archived, and then restored exactly to how they were originally later on. This is to ensure that these png files are the correct size as programs using these files expect them to be. If png files are not the right size, programs may crash (especially if the png files are over sized).

  12. #11
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,828
    Thanks
    287
    Thanked 1,238 Times in 694 Posts
    > to flif files, decompressing/decoding webp files back is apparently not lossless

    Both flif and webp actually encode raw picture (pixels), they're not recompression algorithms.
    .bmp files decoded from .png and dwebp(cwebp(.png)) would be mostly the same.
    Or pngcrush(.png) and pngcrush(dwebp(cwebp(.png))).
    Although webp also discards metainfo.

    And for lossless compression of .pngs I can suggest either precomp, or flif/webp+pngcrush+bsdiff.

  13. Thanks:

    brispuss (2nd January 2020)

  14. #12
    Member
    Join Date
    Jun 2018
    Location
    Yugoslavia
    Posts
    47
    Thanks
    6
    Thanked 1 Time in 1 Post
    from my limited tests, flif has best lossless ratio. however, its slow at decoding and not supported well.
    it seems best to use it for archiving only for now.
    as someone already mentioned, pity it has no 'solid' option yet for large set of pictures like archivers do. ( or dictionary option )

  15. #13
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,828
    Thanks
    287
    Thanked 1,238 Times in 694 Posts
    Well, this says that it isn't: http://qlic.altervista.org/LPCB.html

    As to solid flif - there's support for multi-image files.

  16. #14
    Member
    Join Date
    Jun 2018
    Location
    Yugoslavia
    Posts
    47
    Thanks
    6
    Thanked 1 Time in 1 Post
    sorry, mea culpa.
    so there are: rkim, StuffItDeluxe, Flic, zpaq, bmf, gralic, cmix.
    but most of them are either too slow or too 'exotic' imho.
    stuffit deluxe is even commercial!
    flif is supported by xnview, irfanview, imagemagick.

    which one would you use on linux?




  17. #15
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,828
    Thanks
    287
    Thanked 1,238 Times in 694 Posts
    > stuffit deluxe is even commercial!

    Here's stuffit windows binary: http://nishi.dreamhosters.com/stuffit14_v0.rar

    > which one would you use on linux?

    There's wine on linux, so hard to say. But I like BMF.

Similar Threads

  1. FLIF - Free Lossless Image Format
    By willvarfar in forum Data Compression
    Replies: 173
    Last Post: 28th February 2019, 18:04
  2. flif
    By koppa in forum Data Compression
    Replies: 1
    Last Post: 3rd October 2015, 00:53
  3. batch for vpn auto reconnect (8.1 or 10 tp)
    By necros in forum The Off-Topic Lounge
    Replies: 2
    Last Post: 22nd November 2014, 04:40
  4. A reliable batch image conversion tool
    By m^2 in forum The Off-Topic Lounge
    Replies: 13
    Last Post: 6th August 2012, 15:16
  5. Replies: 4
    Last Post: 17th March 2008, 21:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •