Desperately needing direction with EncoderParameters and saving images under different compression/q

N

NutsAboutVB

Hello,

I am a .NET programmer and I have a JPEG image file (from digital
camera) of about 109 KB's in size, when I open it and save it
(without making any alterations at all, just going to File --> Save) in
MS Photo Editor, the file is automatically shrunk in size to 81 KB's.
When doing the same thing in MS Paint, the file is shrunk to 54 KB's.
The file has the same number of pixels after both saves (as expected).
My question follows...

What are the 'automatic' changes that typical image editing
software products perform to our images APART from any changes or
alterations that we may make ourselves?

I understand that one of these would be some form of compression (say,
at 90) but I am unfamiliar with the other types of alterations that are
made. When I compare the pixels in the original file and the new saved
file (even without making changes, just opening & saving the file) I
get completely different RGB values in each pixel. This is really bad,
since (in my application) I need to be able to predict all typical (non
explicit) changes made by graphics programs to normal images. So I have
tried compressing the images via .NET code (EncoderParameters etc) at
all possible values, 100, 99, 98 etc all the way down to 0 and I can
not reproduce the exact pixel arrangements imposed by MS Photo Editor.

My question is, why can't I, and what other types of transformations
do I need to look into in order to try to replicate (and predict) such
different pixel RGB values/arrangements imposed by various graphics
programs? I don't know much about JPEG so not sure what
ChrominanceTables and Luminance values are. The only thing I've tried
altering is the Encoder.Quality parameter, and this accepts only
parameter values between 0 and 100 of Long (Int64) data type. So in
addition, can't I specify 89.5 or 94.3 (non integer) type values? Is
this not in the JPEG spec to accept decimal values or is the .NET
framework just limited in this way? Because I'm wondering, maybe
these other software applications are specifying decimal fractions for
the Quality setting of the encoder.

So, in summary, just need to know...
1). What types of 'automatic changes' typically occur when an image
is opened & saved using typical graphics programs?
2). If it is possible to pass non integer values floating point values
(Single/Double/Decimal etc) for the Quality setting in the
EncoderParameter object?

I've had too many headaches because of this, Microsoft documentation
is really bad, I understand my purposes may sound uncommon but I really
need to be able to understand the types of automatic changes that are
occurring, thank you in advance. I will respond promptly to all input,
anything would be appreciated at this stage since I'm really empty
direction wise.

Thank you.
 
L

Lucian Wischik

NutsAboutVB said:
What are the 'automatic' changes that typical image editing
software products perform to our images APART from any changes or
alterations that we may make ourselves?

I don't know the answer, sorry. But I've been to several research
talks in the past few months where the vision researches come up with
automatic ways to detect image similarity. It's important for several
consumer-level products -- e.g. automatic image stitching (where you
have to figure out where the edge of one photo is the same as the
opposite edge of another photo), and internet image search, and
producing maps of cities.

It sounds a lot like you should give up on trying to explore
pixel-level differences, and should instead use a more general
solution from this kind of research field.
 
N

NutsAboutVB

Hello,

I appreciate your response and would be happy to look into any relevant
web addresses that you may be able to provide in relation to the
research that you were talking about.

I'm really just trying to figure otu what each application does to the
image pixel wise (i have no care for the meta data or headers, they are
of no relevance to me). if i knew the 'types' of changes that occur,
then i would quite easily write aggressive loops to figure out the
level of alterations that are imposed onto the image (values passed to
encoder parameters etc).

That would be perfect!
 
L

Lebesgue

This is how jpeg works - you can not even get the same rgb values even when
compressing the original image and then compressing the compressed again.
What you should do when you care about exact rgb values is either to look at
some compression method which has such feature (I guess gif would do, maybe
png too) or don't compress the images by aby image compression method at all
and use tiff or bmp images and compress them with come lossless data
compression method (e.g. zip) which will give you about the same compression
ratio as highest quality jpeg. There is also a built-in implementation of
some lossless compression methods (e.g. RLE, LZW) in some tiff/bmp formats.

Hope I have provided at least some pointers.
 
L

Lebesgue

I've read your post again and I think I originally misunderstood your
question.
If I understand correctly, you are not having control over how the images
are compressed and want to process/find differences/ images you possibly get
from the user, who compressed the image with his own software.
As Lucian has suggested, it would be better to look for other solution in
this case, because it would be extra time consuming to try all possible
combinations of compression parameters to find out what the user has used,
and I doubt it would be possible in real time (if you had just 100 levels of
quality and 100 levels of luminance and 100 levels of chrominance you would
have to compress and compare the image 1000000 times, which is not
feasible - and I'm afraid there are even more combinations)
 
N

NutsAboutVB

Lebesgue,

Yes, thats exactly it, I have no control over what others are using, so
i at least need to estimate most common possible types of combinations,
or use completely other form of logic to achieve what i achieve. But,
if you know the types of changes that are performed, perhaps a summary
would be great so that i could resume further pending investigation in
this area. The positive point is that i can take a few hours of time to
process these combination (doesn't need to be real time).

Do you think luminance and chrominance changes are made (without users
request) when they open & save a file? I know that quality (via
compression) alterations are made, but thats about it. Not sure what
other changes occur, nor of their definitions.

I can look up the definitions if i knew the names of the types of
changes which do take place, so if anyone who knows can provide a
simple list that would be very helpful.

In addition, i would also behappy to look into similarity comparison
research and available software/components if they exists, and if
anyone knows, some links or names to look under would be very helpful
:).

Thank you.
 
L

Lucian Wischik

NutsAboutVB said:
I appreciate your response and would be happy to look into any relevant
web addresses that you may be able to provide in relation to the
research that you were talking about.

Sorry, I don't have any precise links. In my mind I was thinking of
this page

http://research.microsoft.com/vision/cambridge/

but all of these are actually trying to solve MUCH harder
generalizations of your problem! Still, reading their publications
might be a good start.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top