Discussion:
JFIF colorspace - working practice
(too old to reply)
Thomas Richter
2009-07-16 10:19:38 UTC
Permalink
Hi folks,

what is the working practice how to interpret the colorspaces in JFIF
(aka "JPEG") files? I'm specifically interested in the case where no
other colorspace information is available in the file.

Details:

JFIF specifies to use the CCITT (now ITU) 601 transformation, you find
the formulas in the JFIF document. However, this is not the complete
story, unlike what most people might think. Rec. 601 *also* defines
primaries for red, green and blue, and gamma values (note that wikipedia
is incorrect here, 601 *is* an absolute color space defining such data).
These values are *different* from the ones specified by sRGB,
unfortunately, which is a colorspace typical for computer monitors; Rec.
601 is typical for TVs.

My question is now, what do existing applications do if they want to
render a JFIF file on a computer screen in the absence of any other
color information in the file. Do they perform (in addition to the YCbCr
to RGB decorrelation) a conversion from 601 to sRGB? Or do they just
render the data "as if" it would be sRGB already, hoping to get away
with that?

Specifically, if you do have a monitor profile and render JFIF to such
monitor, it would be required to first run the YCbCr->RGB transformation
(done in all implementations), then convert Rec.601 RGB to the monitor RGB.

Alternatively, applications might assume that the color space JFIF
renders to is sRGB directly, then doing a sRGB->monitor RGB conversion
(a different one).

For example, the IJG command line tool "djpeg" creates PPM files from
.jpg (JFIF) files by doing the YCbCr -> RGB transformation, nothing
else. As PPM files are in sRGB, the output is "incorrectly" in sRGB, and
not in Rec. 601 RGB. Is that common practice, or is IJG simply ignorant
of color spaces and more professional applications rather assume
Rec.601 RGB instead.

(601 RGB = an RGB color space using the primaries as defined in the
recommendation, with gamma values as defined there. The YCbCr
transformation is irrelevant for this.)

Thanks for opinions,

Thomas
Gernot Hoffmann
2009-07-16 14:46:50 UTC
Permalink
Post by Thomas Richter
Hi folks,
what is the working practice how to interpret the colorspaces in JFIF
(aka "JPEG") files? I'm specifically interested in the case where no
other colorspace information is available in the file.
JFIF specifies to use the CCITT (now ITU) 601 transformation, you find
the formulas in the JFIF document. However, this is not the complete
story, unlike what most people might think. Rec. 601 *also* defines
primaries for red, green and blue, and gamma values (note that wikipedia
is incorrect here, 601 *is* an absolute color space defining such data).
These values are *different* from the ones specified by sRGB,
unfortunately, which is a colorspace typical for computer monitors; Rec.
601 is typical for TVs.
My question is now, what do existing applications do if they want to
render a JFIF file on a computer screen in the absence of any other
color information in the file. Do they perform (in addition to the YCbCr
to RGB decorrelation) a conversion from 601 to sRGB? Or do they just
render the data "as if" it would be sRGB already, hoping to get away
with that?
Specifically, if you do have a monitor profile and render JFIF to such
monitor, it would be required to first run the YCbCr->RGB transformation
(done in all implementations), then convert Rec.601 RGB to the monitor RGB.
Alternatively, applications might assume that the color space JFIF
renders to is sRGB directly, then doing a sRGB->monitor RGB conversion
(a different one).
For example, the IJG command line tool "djpeg" creates PPM files from
.jpg (JFIF) files by doing the YCbCr -> RGB transformation, nothing
else. As PPM files are in sRGB, the output is "incorrectly" in sRGB, and
not in Rec. 601 RGB. Is that common practice, or is IJG simply ignorant
of color spaces and more professional applications rather assume
Rec.601 RGB instead.
(601 RGB = an RGB color space using the primaries as defined in the
recommendation, with gamma values as defined there. The YCbCr
transformation is irrelevant for this.)
Thanks for opinions,
Thomas
Photoshop handles JPEG compression for RGB images as follows:

1. The image compression is executed merely based on RGB numbers.
2. An ICC profile can be embedded.
3. Opening a JPEG with missing profile, or with a profile different to
the
actual working space, the operator can assign a profile.
4. The image is shown via the actual monitor profile (if the color
settings
are correct).

JPEG compression for the Web follows these rules:
1. Convert to sRGB.
2. Apply JPEG compression without embedding a profile.
Here it is assumed that the receiver views through a browser
and the monitor is either calibrated (near to sRGB) or uncalibrated
(bad luck).

JPEG compression for prepress:
The highest quality delivers typically a compression ratio of only 3
and the image appearance is almost identical with the original.
The color space is typically AdobeRGB (aRGB) and the profile is
embedded.
JPEG for prepress is normally not recommended, because not
everybody is aware of the damage for lower quality settings.

A critical test:
1. Convert an aRGB or sRGB image to ProPhotoRGB (pRGB).
2. Save as JPEG without profile (or with profile).
3. Open the JPEG and assign pRGB (or let Photoshop 'honour'
the embedded profile).
4. The color appearance is that of the original image.

IMO a browser without color management sends the RGB numbers
directly to the graphics card. If the monitor is calibrated near to
sRGB,
then an sRGB JPEG would deliver reasonable results (but that's not
accurate, because the monitor profile, which can be (slightly)
different
to sRGB, is not used).

During my own JPEG programming and that of a student, we didn't
encounter anywhere a compulsory color space definition. But that's
long ago:
http://www.fho-emden.de/~hoffmann/jpeg131200.pdf

Best regards --Gernot Hoffmann
glen herrmannsfeldt
2009-07-16 22:03:29 UTC
Permalink
Post by Thomas Richter
JFIF specifies to use the CCITT (now ITU) 601 transformation, you find
the formulas in the JFIF document. However, this is not the complete
story, unlike what most people might think. Rec. 601 *also* defines
primaries for red, green and blue, and gamma values (note that wikipedia
is incorrect here, 601 *is* an absolute color space defining such data).
These values are *different* from the ones specified by sRGB,
unfortunately, which is a colorspace typical for computer monitors; Rec.
601 is typical for TVs.
I would be really surprised if there was a "typical" for TV sets
that was significantly different from that for computer monitors.

Given that Plasma, LED, LCD, and CRT are likely significantly
different due to differences in phosphors, filters, and the
appropriate semiconductor materials, and that it isn't likely
that the factories keep each of those completely separate for
the two product lines.

-- glen
Bob Larter
2009-07-17 05:01:59 UTC
Permalink
Post by Thomas Richter
Hi folks,
what is the working practice how to interpret the colorspaces in JFIF
(aka "JPEG") files? I'm specifically interested in the case where no
other colorspace information is available in the file.
JFIF specifies to use the CCITT (now ITU) 601 transformation, you find
the formulas in the JFIF document. However, this is not the complete
story, unlike what most people might think. Rec. 601 *also* defines
primaries for red, green and blue, and gamma values (note that wikipedia
is incorrect here, 601 *is* an absolute color space defining such data).
These values are *different* from the ones specified by sRGB,
unfortunately, which is a colorspace typical for computer monitors; Rec.
601 is typical for TVs.
My question is now, what do existing applications do if they want to
render a JFIF file on a computer screen in the absence of any other
color information in the file. Do they perform (in addition to the YCbCr
to RGB decorrelation) a conversion from 601 to sRGB? Or do they just
render the data "as if" it would be sRGB already, hoping to get away
with that?
Either "as is", or it's assumed to be sRGB, depending on the viewing
program.
--
W
. | ,. w , "Some people are alive only because
\|/ \|/ it is illegal to kill them." Perna condita delenda est
---^----^---------------------------------------------------------------
iman islam
2009-07-17 22:13:41 UTC
Permalink
GENERAL CRITERIA OF THE TRUE RELIGION


What you are about to read might sound unusual but it could be very
enlightened.


GENERAL CRITERIA OF THE TRUE RELIGION
Every adherent of a creed believes that his creed is the true one, and
all followers of a religion believe that their religion is the ideal
one and the most upright path. When you ask the followers of
adulterated religions or followers of man-made creeds about the proof
for their belief, they argue that they found their fathers on a faith
and are just following their paths. They then relate narrations and
stories whose chains of transmitters are not sound and whose texts are
not free from faults and defects. They only depend on inherited books
whose authors, recorders and even their original languages and their
sources are unknown. They are only mixed-up stories concocted
together, magnified and inherited generation



after generation without any scholastic verification of their chains
of transmitters and precise checking of their texts.These unknown
books, narrations and blind imitations cannot be taken as evidences in
matters of religions and beliefs. Or is it possible that all these
adulterated religions and man-made creeds are true or false?It is
impossible that all these religions are true, for truth is only one
and cannot be numerous. It is also impossible that all these
adulterated religions and man-made beliefs are all from Allaah and
therefore true. Then, since there are numerous religions and the true
is only one, which of them is then the true religion? There should,
therefore, be criteria for distinguishing the true religion from the
false. If we find that these criteria fit a religion, we know that it
is the true religion; and when all or one of these criteria is lacking
in any religion, we know that it is a false religion. The criteria by
which we distinguish the true religion from the false ones are:

One: That the religion must be from Allaah, revealed through an angel
to one of His Messengers in order to convey it to mankind. For the
true religion is Allaah’s, and it is He Who will recompense His slaves
and take them to reckoning on the Day of Resurrection concerning the
religion that He revealed to them. He says,“Verily, We have sent the
revelation to you (O Muhammad) as We sent the revelation to Nooh
(Noah) and the Prophets after him; We also sent the revelation to
Ibraheem (Abraham), Ismaa’eel (Ishmael), Is’haaq (Issac), Ya‘qoob
(Jacob) and Al-Asbaat (the offspring of the twelve sons of Ya‘qoob),
‘Eesaa (Jesus), Ayoob (Job), Yoonus (Jonah), Haroon (Aaron) and
Sulaiman (Solomon); and to Dawood (David) We gave the Psalms.”[1]He,
may He be glorified- also says,“And We did not send any Messenger
before you (O Muhammad) but We revealed to him (saying): none has the
right to be worshipped but Me. So worship Me.”[2]Based on the above
verses and criteria, any religion that is brought by any man and
attributed to himself and not to Allaah is definitely a false
religion.

Two: That the religion should call to the worship of Allaah alone;
should prohibit Shirk (polytheism of any form) and all that can lead
to it. This is because, the call to the oneness of Allaah is the
primary mission of all Prophets and Messengers. Every Prophet told his
people: “Worship Allaah! You have no other god but Him.”[3]

Three: It should be in agreement with the principles unto which all
the Messengers call their people which are to worship Allaah alone and
to avoid polytheism, unruliness to parents, killing of a person
unjustly and all other immoral things, be they hidden or apparent.
Allaah says,“And We did not send any Messenger before you (O Muhammad)
but We revealed to Him (saying): None has the right to be worshipped
but I, so worship Me.”[4]He also says,“Say (O Muhammad): Come I will
recite what your Lord has prohibited you from: Join not anything in
worship with Him; Be good and dutiful to your parents; kill not your
children because of poverty – We provide sustenance for you and for
them; come not near to Al-Fawaahish (Shameful sins, illegal sexual
intercourse) whether committed openly or secretly; and kill not anyone
whom Allaah has forbidden, except for a just cause (according to
Islaamic Law). This He has commanded you that you may understand.”[5]
He also says,“And ask (O Muhammad) those of Our Messengers whom We
sent before you: ‘Did We ever appoint gods to be worshipped besides
the Most-Gracious (Allaah).’ ”[6]

Four: It should not be self-contradicting by commanding a matter and
contradicting it by another. It should also not forbid something and
then allow what is similar to it without any reason or prohibit
something for some group and permit it for others. Allaah says,“Do
they not then consider the Qur’aan carefully? Had it been from other
than Allaah, they would surely have found therein many
contradictions.”[7]

Five: The religion should include what can preserve for people, their
religion, honour, properties, lives and offspring through its
commandments, prohibitions, deterrents and morals that it ordains to
protect these five general factors.

Six: It should serve as a mercy for mankind and save them from their
own injustices and the injustices they commit against one another
through usurping others’ rights and the general amenities or through
misleading the weak at the hands of the strong. Allaah says while
explaining the mercy that the Torah which was given to Prophet Moosaa
entails,“And when the anger of Moosaa was calmed down, he took up the
Tablets; and in their inscription was guidance and mercy for those who
fear their Lord.”[8]He also says informing us about the message of
Prophet Eesaa,“And (We wish) to appoint him as a sign to mankind and a
mercy from Us.”[9]He says about Prophet Saalih,“He said, ‘O my people:
Tell me, if I am (acting) on a clear proof from my Lord, and there has
come to me a mercy (Prophethood) from Him, who will save me from
Allaah if I disobey Him?’”[10]He says about the Qur’aan,“And We send
down of the Qur’aan that which is a healing and a mercy to those who
believe.”[11]

Seven: It should entail guidance to the Law of Allaah, and teach man
the intention of Allaah by that Law. It should also be able to tell
man his origin and his final destination. Allaah says about the
Torah,“Verily, We did send down the Torah, therein was guidance and
light.”[12]He says about the Injeel (the Book given to Eesaa),“And We
gave him the Injeel, in which was guidance and light.”[13]He says
about the Qur’aan,“It is He Who has sent His Messenger (Muhammad) with
guidance and the religion of truth.”[14]The true religion is the one
that includes guidance to the Law of Allaah, gives peace and
tranquillity to the mind, protect it from all insinuations, answers
all its questions and resolves every problem.

Eight: It should call to noble characters and deeds like
truthfulness, honesty, modesty, chastity and generosity. It should
also prohibit bad conducts like disobedience to parents, killing
innocent souls, all kinds of immoralities, lies, injustice,
aggression, stinginess and sins.

Nine: It should be able to provide happiness for those who believe in
it. Allaah says,“Taa Haa. We have not sent down the Qur’aan unto you
(O Muhammad) to cause you distress.”[15]It should also be in harmony
with upright nature. “(This is) Allaah’s nature upon which He has
created mankind.”[16]It must also be in harmony with sound reason,
because the true religion is legislated by Allaah and the sound reason
is created by Allaah and it is therefore impossible that the Law of
Allaah and the creatures of Allaah should contradict each other.

Ten: It should lead to the truth, warn against falsehood, keep people
away from error and lead them to the Straight Path where there is no
crookedness. Allaah speaks about the jinn that when they heard the
Qur’aan being recited, some of them told others, “O our people!
Verily! We have heard a Book (the Qur’aan) sent down after Moosaa,
confirming what came before it: It guides to the truth and the
Straight Path.”[17]It should not call to what will cause people
misery, as Allaah says about the Qur’aan,“Taa Haa. We have not sent
down the Qur’aan unto you to cause you distress.”[18]The true religion
should also not enjoin on people what can cause them destruction.
Allaah says,“And do not kill yourselves. Surely, Allaah is the Most-
Merciful to you.”[19]It should also not distinguish between its
adherents on the basis of race, colour or clan. Allaah says,“O
mankind! We have created you from a male and a female and made you
into nations and tribes, that you may know one another. Verily, the
most honourable of you with Allaah is that (believer) who is most
pious. Verily, Allaah is All-Knowing, All-Aware.”[20]Therefore, the
recognised criterion for giving people precedence in the true religion
is piety.After mentioning the criteria for distinguishing between the
true religion and the false ones and citing evidences from the Qur’aan
that these Criteria are general in the case of all truthful Messengers
sent by Allaah, it is then very appropriate to mention types of
religion.

ByDr. Muhammad bin Abdullaah As-SuhaymTranslated byAbdur-Raafi Adewale
Imaam


———————————–

For more information about Islam
http://english.islamway.com/

http://www.islamhouse.com/

http://www.discoverislam.com/

http://www.islambasics.com/index.php

http://english.islamway.com/

http://www.islamtoday.net/english/

http://www.islamweb.net/ver2/MainPage/indexe.php

http://www.sultan.org/

Contact Us At

***@gmail.com
Jürgen Exner
2009-07-17 22:17:25 UTC
Permalink
Post by iman islam
GENERAL CRITERIA OF THE TRUE RELIGION
---> It doesn't spam Usenet.

jue
Pete Fraser
2009-07-17 22:31:31 UTC
Permalink
Post by iman islam
GENERAL CRITERIA OF THE TRUE RELIGION
Ten: It should lead to the truth, warn against falsehood,
I assume that means it should not post to usenet under
deceptive titles.
Ray Fischer
2009-07-18 06:31:25 UTC
Permalink
Post by iman islam
GENERAL CRITERIA OF THE TRUE RELIGION
Top 10 reasons why Beer is better than Religion...

10. No one will kill you for not drinking Beer.

9. Beer doesn't tell you how to have sex.

8. Beer has never caused a major war.

7. They don't force Beer on minors who can't think for themselves.

6. When you have a Beer, you don't knock on people's doors trying to
give it away.

5. Nobody's ever been burned at the stake, hanged, or tortured over
his brand of Beer.

4. You don't have to wait 2000+ years for a second Beer.

3. There are laws saying Beer labels can't lie to you.

2. You can prove you have a Beer.

1. If you've devoted your life to Beer, there are groups to help you
stop.
--
Ray Fischer
***@sonic.net
Ross Ridge
2009-07-25 15:49:36 UTC
Permalink
Post by Thomas Richter
JFIF specifies to use the CCITT (now ITU) 601 transformation, you find
the formulas in the JFIF document. However, this is not the complete
story, unlike what most people might think. Rec. 601 *also* defines
primaries for red, green and blue, and gamma values (note that wikipedia
is incorrect here, 601 *is* an absolute color space defining such data).
These values are *different* from the ones specified by sRGB,
unfortunately, which is a colorspace typical for computer monitors; Rec.
601 is typical for TVs.
JFIF 1.02 says:

The color space to be used is YCbCr as defined by CCIR 601 (256
levels). The RGB components calculated by linear conversion from
YCbCr shall not be gamma corrected (gamma = 1.0).

So raw decoded JFIF RGB output values aren't supposed to be in either
sRGB or Rec. 601 RGB.
Post by Thomas Richter
For example, the IJG command line tool "djpeg" creates PPM files from
.jpg (JFIF) files by doing the YCbCr -> RGB transformation, nothing
else. As PPM files are in sRGB, the output is "incorrectly" in sRGB, and
not in Rec. 601 RGB. Is that common practice, or is IJG simply ignorant
of color spaces and more professional applications rather assume
Rec.601 RGB instead.
I believe djpeg predates PPM files being defined as using the CIE Rec. 709
colour space and just outputs files in the linear PPM variant.

In practice I expect most applications don't do any colour space
conversions before displaying JFIF images.

Ross Ridge
--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] ***@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Thomas Richter
2009-07-25 17:31:33 UTC
Permalink
Post by Ross Ridge
Post by Thomas Richter
JFIF specifies to use the CCITT (now ITU) 601 transformation, you find
the formulas in the JFIF document. However, this is not the complete
story, unlike what most people might think. Rec. 601 *also* defines
primaries for red, green and blue, and gamma values (note that wikipedia
is incorrect here, 601 *is* an absolute color space defining such data).
These values are *different* from the ones specified by sRGB,
unfortunately, which is a colorspace typical for computer monitors; Rec.
601 is typical for TVs.
The color space to be used is YCbCr as defined by CCIR 601 (256
levels). The RGB components calculated by linear conversion from
YCbCr shall not be gamma corrected (gamma = 1.0).
So raw decoded JFIF RGB output values aren't supposed to be in either
sRGB or Rec. 601 RGB.
How do you read this into the above statement? The first sentence
explicitly states that the color space *is* CCIR (now ITU) 601.

Unfortunately - or fortunately - this is not how JFIF is used. The
confusion created by JFIF is that they use YCbCr as *decorrelation*
transformation to minimize the energy in chroma, but not Rec. 601 as a
color space, which is what is stated.

I'm now even more confused, please explain.
Post by Ross Ridge
Post by Thomas Richter
For example, the IJG command line tool "djpeg" creates PPM files from
.jpg (JFIF) files by doing the YCbCr -> RGB transformation, nothing
else. As PPM files are in sRGB, the output is "incorrectly" in sRGB, and
not in Rec. 601 RGB. Is that common practice, or is IJG simply ignorant
of color spaces and more professional applications rather assume
Rec.601 RGB instead.
I believe djpeg predates PPM files being defined as using the CIE Rec. 709
colour space and just outputs files in the linear PPM variant.
It uses a linear transformation, but the output color space doesn't have
a linear gamma, i.e. gamma correction is done by the monitor as usual.
Post by Ross Ridge
In practice I expect most applications don't do any colour space
conversions before displaying JFIF images.
That's what I would believe as well, but then JFIF should probably
specify that

a) the YCbCr to RGB transformation applies to the raw sample values as
"decorrelation transformation",
b) the output color space of this transformation is sRGB.

This is not what it says, unfortunately.

Greetings,
Thomas
Ross Ridge
2009-07-27 02:18:10 UTC
Permalink
Post by Thomas Richter
That's what I would believe as well, but then JFIF should probably
specify that
a) the YCbCr to RGB transformation applies to the raw sample values as
"decorrelation transformation",
b) the output color space of this transformation is sRGB.
This is not what it says, unfortunately.
Remember that the JFIF document was written before sRGB existed, so that's
not a reasonable expectation. I beleive the intent of the document was
to specify that a) the YCbCr to RGB transform is done using the equations
given, b) the resulting output color space is linear RGB (gamma = 1.0).
That seems to be the common interpretation, and I think specifying any
other RGB color space would've been fairly radical at the time.

Applications should've done gamma correction (from whatever output
colour space JFIF actually specified) before displaying JFIF images,
but apparently many didn't think it was worth the trouble. Back when
the World Wide Web was young and 256 colour graphics looked impressive,
maybe it wasn't. In any case the trick now is to encode JPEG images as if
sRGB was specified, knowing that outside of a professional setting that's
most likely way to get the image to display as intended. Accordingly
applications that display JPEG images that don't have some other extension
specifying the colour space should follow existing practices and display
the RGB values as is. In this respect JFIF is a broken standard, so it
really doesn't matter it actually says or was intended to say.

Ross Ridge
--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] ***@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Mihai Cartoaje
2009-07-25 22:24:50 UTC
Permalink
Post by Thomas Richter
what is the working practice how to interpret the colorspaces in JFIF
(aka "JPEG") files? I'm specifically interested in the case where no
other colorspace information is available in the file.
They are sent unchanged to the video card. ATI cards have linear gamma
as the default setting.
Mihai Cartoaje
2010-05-22 11:23:04 UTC
Permalink
I wrote a program to measure the gamma for the computer I bought in 1996,
and it was linear to within experimental error.

There's this from Pennebaker & Mitchell 1993 p.26:

"The capture device is typically the most linear part of the system, in
that the quantum efficiency (the number of electrons emitted for each
photon arriving from the image) is quite constant in a well-designed and
well-calbrated imaging device. (Quantum efficiency is usually dependent
on the color of the light.)

The output device, especially if it is a CRT display, is often quite
nonlinear. A gamma correction is often applied to displays to correct for
the nonlinear characteristics of the electron gun and to make the
visually perceived output fairly linear. In critical applications the
device characteristics should be measured and the input corrected to
achieve a linear response."

Intel graphics chips also have linear gamma as the default setting:
http://www.intel.com/support/graphics/sb/cs-013542.htm

Loading...