Results 1 to 13 of 13

Thread: Anyone thought of this yet? (Image Compressor Idea)

  1. #1
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts

    Anyone thought of this yet? (Image Compressor Idea)

    I've been testing some different ways of compressing images and I think it has potential but am not fully sure if it would be lossless.
    By converting bmp's using the RichTextFormat hex-coder I've been able to compress images down to half of what fp8 and bcif could achieve but I have no way of confirming it is lossless since I do not have the tools to extract the bmp's hex data from the rtf file.
    It was tested as such:
    1) Import bmp to rtf.
    2) apply (yuta's) openBWT onto the rtf. (BWT works best on this output)
    3) shelwien's sse arithmetic coder.

    I'd like to know if it would work as a lossless system but I am skeptical since I couldn't find out much on the hex-coder's properties.
    Last edited by Lucas; 3rd May 2015 at 03:13.

  2. #2
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    screenshoot it (at the right zoom level)
    copy paste out the picture area.
    do and diff vs original in any photo editor

  3. #3
    Member jibz's Avatar
    Join Date
    Jan 2015
    Location
    Denmark
    Posts
    114
    Thanks
    91
    Thanked 69 Times in 49 Posts
    Since rtf does not support bmp, some kind of conversion is going on in step 1), perhaps to WMF.

    As a quick test, I took a bmp and inserted it into a document using WordPad (comes with Windows), and then compressed both the original bmp and the rtf file using bzip2, and indeed the compressed rtf file is quite a bit smaller.

    I would guess the conversion to WMF is somehow lossy, or scales the image data, but I have nothing to back it up, other than it being unlikely that converting an image to ASCII hex makes it more compressible.

  4. #4
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts
    I did what you suggested and it seems that there is some anti-aliasing going on in the rtf but I do not see how that alone increases the compressibility of it. Maybe it is normalizing some color frequencies in this transform?

    *Correction. Wordpad may be anti-aliasing the image and causing distortion in the results.
    Last edited by Lucas; 4th May 2015 at 01:05.

  5. #5
    Member Jaff's Avatar
    Join Date
    Oct 2012
    Location
    Dracula's country
    Posts
    100
    Thanks
    112
    Thanked 20 Times in 16 Posts
    most of RTF programs compress imported images to PNG (loseless).

  6. #6
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts
    Quote Originally Posted by Jaff View Post
    most of RTF programs compress imported images to PNG (loseless).
    I tried this in Wordpad (importing a png then saving as an rtf). It produced a file identical in size as the bmp.

    Maybe it is lossless...

  7. #7
    Member Jaff's Avatar
    Join Date
    Oct 2012
    Location
    Dracula's country
    Posts
    100
    Thanks
    112
    Thanked 20 Times in 16 Posts
    Try Atlantis Word Processor.

  8. #8
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts
    Alright, it does store png but in hexadecimal form, so you'd need to compress it again using an external compressor to achieve png-like size. But that's not what i wanted to know, what I'd like to know is what's going on in rtf when saving an uncompressed bitmap that allows it to compress so well.
    Last edited by Lucas; 4th May 2015 at 01:14.

  9. #9
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts
    I used this for differencing the original image and one the image in the rtf. http://huddle.github.io/Resemble.js/
    If it is in-fact just anti-aliasing from wordpad it should be lossless.

    I'll report back with my findings from Microsoft's RTF image specs in a while.

  10. #10
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts
    From what I've read, rtf uses an Anisotropic map for bitmaps within a WMF.
    This map is likely lossy and what caused the anti-alias type distortion.
    Maybe there's a way to recode the map so it is lossless but I'd assume that would be pretty difficult (in a bijective sense) since it'd need to cancel out all distortion.
    Maybe using the anisotropic filter and saving a copy of the difference of the original image would work.
    Last edited by Lucas; 4th May 2015 at 06:45.

  11. #11
    Member Jaff's Avatar
    Join Date
    Oct 2012
    Location
    Dracula's country
    Posts
    100
    Thanks
    112
    Thanked 20 Times in 16 Posts
    Quote Originally Posted by Lucas View Post
    what I'd like to know is what's going on in rtf when saving an uncompressed bitmap that allows it to compress so well.
    Try to replace or insert an uncompressed PNG (saved using XnView, compression level 0) or simply don't use RTF anymore and convert BMP to HEXa then apply BWT etc

  12. #12
    Member
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    154
    Thanks
    20
    Thanked 66 Times in 37 Posts
    Quote Originally Posted by Jaff View Post
    convert BMP to HEXa then apply BWT
    That alone isn't enough to cause the image to compress so well.
    In fact any hexcoder worsens compression.

  13. #13
    Member Jaff's Avatar
    Join Date
    Oct 2012
    Location
    Dracula's country
    Posts
    100
    Thanks
    112
    Thanked 20 Times in 16 Posts
    I know. The "magic" is when you have some uncompressable data (PNG) then make it compressable again with conversion to hex (text) and applying BTW

Similar Threads

  1. StartMT (an idea)
    By SvenBent in forum Data Compression
    Replies: 4
    Last Post: 13th May 2014, 18:07
  2. BIM (a new lossless image compressor) is here!
    By encode in forum Data Compression
    Replies: 43
    Last Post: 17th September 2013, 15:00
  3. FLIC - a new fast lossless image compressor
    By Alexander Rhatushnyak in forum Data Compression
    Replies: 25
    Last Post: 10th January 2013, 19:46
  4. New lossless image compressor
    By encode in forum Data Compression
    Replies: 105
    Last Post: 10th January 2013, 10:36
  5. GraLIC - new lossless image compressor
    By Alexander Rhatushnyak in forum Data Compression
    Replies: 17
    Last Post: 29th November 2010, 21:27

Posting Permissions

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