Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Image Encryption + Decryption = Smaller Image?]  (Read 614 times)
0 Members and 1 Guest are viewing this topic.
Offline GabrielBailey74

JGO Knight


Medals: 8
Projects: 6


<3 Java


« Posted 2013-01-06 09:02:46 »

Hey JGO, I'll Start this post off by saying that I've never really messed around with creating/recreating Buffered Images via pixel data before.
(So maybe this is a common ordeal?)  Shocked

I was bored today Emo, and decided to make a program that would:

A: Scan a Image, get the pixel data.
B: Export the recreated Image (.JPG).
C: Encrypt the recreated Image (.IDX / .DAT).
D: Export the decrypted image (.IDX > .JPG).

The Image that I'm using: (rather large)
http://edmullen.net/test/imagefiletest.php

Somehow during this process after I recreate the Image via the decrypted file's data, it reduced the size dramatically?
No Image Quality / Pixel Data Loss.

1  
2  
3  
4  
5  
6  
< Input
(Original.jpg) 5,826 kb (3264x2448)
> Output
(Initial-encrypt.jpg) 5,826 kb (3264x2448)
(Initial-decrypt.jpg) 966 kb (3264x2448)
Finished...!


Is Java doing something that I'm missing?  Stare Stare


Or did I just make a new tool?

Online moogie

JGO Knight


Medals: 7
Projects: 5


Java games rock!


« Reply #1 - Posted 2013-01-06 09:07:03 »

just to be sure have you actually done a per pixel comparison to confirm no difference between the two images?

Offline GabrielBailey74

JGO Knight


Medals: 8
Projects: 6


<3 Java


« Reply #2 - Posted 2013-01-06 09:20:15 »

One second I'm scanning and comparing them.
7,990,272 pixels O.O will it be a while? Emo

EDIT: No pixel loss what so ever was the result Grin

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jonjava

JGO Knight


Medals: 33



« Reply #3 - Posted 2013-01-06 10:41:59 »

Is java doing something that you're missing? Probably not.

What happens is whatever is written in the code. Since I can't see the code I've no idea.

Most likely it does exactly what you said. It scans the pixel data and recreates the image. Scraping off all other "unnecessary" bytes from the original. I'm not too familiar with the different image standards but I imagine it's more or less like converting a jpeg into a png image.

Why the size difference is so significant I don't know since, as I said, I'm not familiar with the jpeg standard in detail.

Could be that the original jpeg has other stuff compressed within than just pixel data, try extracting it.

http://lifehacker.com/282119/hide-files-inside-of-jpeg-images

Offline Best Username Ever

Junior Member





« Reply #4 - Posted 2013-01-06 18:15:03 »

JPEGs can store a lot of ordinary non-pixel data. Comments and other EXIF data for example. Progressively loading images store more information than non-progressive images. That image apparently also has its own color profile built into it (though I don't know what that means.) Saving it in another program seems to strip data the same way. I got the file size down to 2MB simply by doing that.
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (143 views)
2013-05-17 21:29:12

alaslipknot (151 views)
2013-05-16 21:24:48

gouessej (182 views)
2013-05-16 00:53:38

gouessej (175 views)
2013-05-16 00:17:58

theagentd (186 views)
2013-05-15 15:01:13

theagentd (171 views)
2013-05-15 15:00:54

StreetDoggy (214 views)
2013-05-14 15:56:26

kutucuk (239 views)
2013-05-12 17:10:36

kutucuk (237 views)
2013-05-12 15:36:09

UnluckyDevil (243 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.077 seconds with 20 queries.