0

I am using AES algorithm to encrypt image and is displaying after decryption.But after decryption the picture quality is significantly reducing,

now i want to know did encryption reduce picture quality? Is there any way to enhance them

Miral Dhokiya
  • 1,720
  • 13
  • 26
Geethu
  • 1,586
  • 6
  • 21
  • 34
  • Do you convert the image into JPEG before encrypting or after encryption? – Raghav Sood Jan 16 '13 at 10:30
  • yes the image is storing in .jpg extension after encryption – Geethu Jan 16 '13 at 10:31
  • 4
    Well, that's probably your problem. JPEG is a lossy format. Try using PNG. – Raghav Sood Jan 16 '13 at 10:32
  • 1
    Encryption (and decryption) is lossless. (Otherwise it would be a problem when you send your bank account details over an encrypted connection!) – Veger Jan 16 '13 at 10:35
  • Also we'll need to see some code. – Reno Jan 16 '13 at 10:35
  • @Reno why? The problem is solved already: do not use JPEG if you do not allow a quality degrade – Veger Jan 16 '13 at 10:37
  • 1
    Yes the problem is solved theoretically, even with JPG's OP can change the Q factor which may or may not be more convenient to OP: http://stackoverflow.com/questions/4579647/how-to-save-a-jpeg-image-on-android-with-a-custom-quality-level – Reno Jan 16 '13 at 10:40
  • using which format i can achieve maximum quality – Geethu Jan 16 '13 at 10:48
  • PNG is lossless and has the best quality. http://stackoverflow.com/questions/4573676/saving-as-a-png-image-in-android – Reno Jan 16 '13 at 13:05
  • @RaghavSood Please post your comment as an answer so this can be marked as answered. – Duncan Jones Jan 17 '13 at 08:44

1 Answers1

0

You are using the JPEG format when you decrypt your image.

JPEG is a lossy format as it uses compression on your photo to save disk space. This can result in a noticeable loss of quality. Instead of JPEG, try using PNG, a lossless format for saving your file.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195