the difference between saving grayscale and RGB image in JPEG format

  • Permalink
  • submit to reddit
  • Email
  • Follow


Say I have a three dimensional array 'A', contain an RGB image.
I 'imwrite' this array 'A' in JPG format, with quality = 100 (maximum), let's say it is saved in the name 'A.jpg'.
Then I 'imread' the picture 'A.jpg' and save it in 'A2' array.
If I 'imsubtract' array 'A' from 'A2', I can see from the result that their pixel's values are far different. Well not that far, but yeah they are different (in a range of 8 till 50 or so).

If I treat a grayscale image that way (from the 'imwrite' till the 'imsubtract' process) the difference won't be that far (just in a range of -1 til 1).

This does not happen in BMP, PNG, or TIF format. So I guess it's because of the JPEG compression effect.
But why the RGB image affected more?
Anybody can explain why?
Thank you very much...

Best regards
0
Reply Yuwono 3/20/2010 3:20:05 PM

See related articles to this posting

comp.soft-sys.matlab 203521 articles. 529 followers. Post

0 Replies
972 Views

Similar Articles

[PageSpeed] 46


Reply:

Similar Artilces:

save CMYK image into JPEG format
Hi guys, I've a problem with CMYK e JPEG file format: I'm using python for develop a program which generate an image file from a PIL RGB image. the problem is when i must save my image CMYK into a JPEG file. well, the result is that my new image is only black! but if I save my file in a .tif file, I'll see it well. I don't know why! I'm desperate! Please help me!! thx In article <1133815797.411189.47900@g14g2000cwa.googlegroups.com>, mariano.difelice@gmail.com wrote: > the problem is when i must save my image CMYK into a JPEG file. > well, the result is...

saving result image in different formats
Is there any method for saving result image in different formats (like bmp,jpeg) in gui. but I want to save only result that shows on axes not whole figure image that contains buttons, axes, text box, ... I found myself here is the answer X=getframe(gca); if isempty(X.colormap) imwrite(X.cdata, 'cbv.bmp') end umut wrote: > > > Is there any method for saving result image in different formats > (like bmp,jpeg) in gui. > but I want to save only result that shows on axes not whole figure > image that contains buttons, axes, text box, ... ...

saving jpeg image at different quality
Hi, I am trying to subtract two images, one an original image and second-the same image compressed at a different quality, and study the result. However i get a a black image as output, which should not be the case. Bu=imread('baboon.jpg'); Bu=rgb2gray(Bu); imwrite(Bu,'baboonQ0.jpg','quality',45) Su=imread('baboonQ0.jpg') B=im2double(Bu) S=im2double(Su) sub=B-S figure,imshow(B),title('Original') figure,imshow(sub),title('subtracted') I tried for different compression qualities but i still get a black image as output. Please help. ...

To work & save image in jpeg format
hello, i am working with the image toolbox on matlab 7... when working with jpeg images, opening and using them is fine but while saving it back in jpeg format matlab applies the jpeg compression algorithn thus affecting my imgae... is there any way i can prevent this from happening and still have my output image in jpeg format? thanks a lot advance gaurav ...

To work & save image in jpeg format #2
hello, i am working with the image toolbox on matlab 7... when working with jpeg images, opening and using them is fine but while saving it back in jpeg format matlab applies the jpeg compression algorithn thus affecting my imgae... is there any way i can prevent this from happening and still have my output image in jpeg format? thanks a lot advance gaurav Gaurav S wrote: > > > hello, > i am working with the image toolbox on matlab 7... when working > with > jpeg images, opening and using them is fine but while saving it > back > in jpeg format matlab applies the jpeg...

any image format can compress between JPEG-LS and HD-PHOTO for RGB lossless?
Hi all, Speaking about lossless RGB compression, I had some tests and found out that actually JPEG-LS (using a channel decorrelation as G R-G B-G) seems to give the best compression results, followed by MS HDPhoto (lossless mode) and then others (my tests are based on Photoshop plugins). Do you think there would be any other image format comparable in RGB compression size wich can be found between JPEG-LS and HD-Photo? As I am not an expert in this field, I think that any other format able to compress a test image set at size between JPEG-LS and HD-PHoto would be considered a good one, may th...

How to display rgb image in one axes box and change from rgb image to grayscale to another axes box?
Hallo, everyone! I am a new community of Matlab Central and I just started to use matlab for my University projects. So I have a problem that when I have two axes which tag are P_Org_Image and P_Grayscale_Image, I cannot load the RGB image to P_Org_Image axes box and the grayscale of the same RGB image to P_Grayscale_Image axes box. part of my programming : . : : Img = imread(FileName); set(handles.P_Org_Image,'Visible','OFF'); imshow(Img); I= imread (FileName); G = rgb2gray(I); set(handles.P_Grayscale_Image,'Visible','OFF'...

How to convert RGB image to grayscale image?
Hye..i'm a final year student of Software Engineering.. Since i have to complete my final project,i need assist on how to use the Matlab. My project is about on how to detect the pattern texture/structure of fabric image. Here are some of my problems... -> How can i convert the RGB image to Grayscale image using matlab? -> How i can transfer the filtering image into fast fourier transformation graph? (since i use that technique on pattern recognization.) -> Is that any references that may helps me on how to learn the process of fast fourier transformation? Really need helps from...

How to convert RGB image to grayscale image in GUI?
Hye,,,, How to convert RGB image to grayscale image in GUI? Ok,my problem is...after i browse the picture of RGB image in the GUI (the image is then appear in axes1),and then i press on the push button,(let say the button's name is CONVERT)..the grayscale image doesn't shows in the axes2.I'd try this coding,but it doesn't works on my system.So,any helps from u guys? plz....i need your assist...tq.. ;( %to browse the picture function pushbutton2_Callback(hObject, eventdata, handles, varargin) [filename2,pathname] = uigetfile ({'*.jpg';'*.gif';'*.bmp';&#...

Is it possible to get back from Grayscale image to RGB image
Hai, Is there any way to get back from Gray scale image to RGB Image. can anyone suggest me, thanks in advance. regards, Shan... "Shanmugam Kannappan" <shanmugambe@gmail.com> wrote in message <ggaum9$smk$1@fred.mathworks.com>... > Hai, > > Is there any way to get back from Gray scale image to RGB Image. > > can anyone suggest me, > > thanks in advance. > > regards, > > Shan... If you threw away the color information, there's no way of getting back to the "true" image. However, if you want to synthesize coloring ...

How to convert RGB image to grayscale and convert it back to RGB again
Hi, I have question about converting image to grayscale and convert back to its original type.I am having hard time figuring out how to convert back the image that I've already converted to grayscale. Is there any build in function in mathlab that can do that ? for instance [X, cmap] = imread('Photo.jpg'); J = rgb2gray(X); after i did all my operations on grayscaled image now how can I convert it back? Can anyone please help me sajjad dadkhah Did you happen to look at the help for rgb2gray and notice the mention of ind2rgb at the bottom? That's the function you ...

How to combine 3 grayscale images into one RGB color image ?
How to combine 3 grayscale images into one RGB color image ? I have 3 "DensityGraphics" pictures and I want to combine them in such a way that the one represents the Red, the others - green and blue colors correspondingly. This procedure is called "merge channels" in Photoshop. It must be quite easy to solve that even without external packages, but I am not experienced enough. Thank you. I don't understand mixing colors so this probably isn't right, but it may get you started. Needs["Graphics`"]; nr=5;nc=4; r=Table[Random[],{nr},{...

image format conversion (.SDT to .JPEG / .BMP / .TIFF images)
Hello All; &nbsp; I am developing a Labview software module for our TCSPC (Time Correlated&nbsp;Single Photon Counting)&nbsp;laser microscope. A part of my module generates .SDT images via the Becker-Hickl SPC-830 photon counter. I want to convert those images to BMP / JPEG&nbsp;/ TIFF within labview if possible, &nbsp; Does anyone has done this before, or has any idea how to do this? &nbsp; Thanks, &nbsp; &nbsp; Muttee Sheikh Photonics Research Group, Dept. of Electrical and Computer Engineering, University of Toronto, Canada (647)686-5152 As far as I know ...

Saving in jpeg format
Hi, I have a problem with PSP 8.01. When I try to save a file in jpeg standard format, PSP crashs. It does not really crashs, it justs does not answer anymore and I have to kill the task. Saving in progressive encoding works though... Anyone has an idea why ? Thanks Not sure, but it might have something to do with EXIF info. Are you editing photos? "Silivren Eryn-Duin" <privacy@nospam.net> wrote: >>Hi, >> >>I have a problem with PSP 8.01. When I try to save a file in jpeg standard >>format, PSP crashs. It does not really crashs, it justs doe...

rgb to grayscale image
Hi, I have read that the function rgb2gray works by eliminating hue and saturated pixels, so If I convert an rgb image into a grayscale would I loose any information? for example, I am imaging the intensity profile of white light beam with a digital camera, when I convert to grayscale would that distort the imaged light beam profile? Nathan wrote: > > > Hi, > > I have read that the function rgb2gray works by eliminating hue and > saturated pixels, so If I convert an rgb image into a grayscale > would > I loose any information? for example, I am imaging the intensity &...

Different JPEG formats
I opened a JPEG in PS 7, made some changes, and then saved it again. But the program that uses the image as a resource is now giving me an error, saying that it doesn't support this specific JPEG format. When I save using PS 7, the first line of JPEG is (excluding non-printable characters): ����JFIFHH��#ExifMM*bj(1r2i�HHAdobe Photoshop 7.02006:01:27 14:58:04��`h(&!�HH����JFIFHH��Adobe_CM��Adobed�� However, the original JPEG has the following first line: ����JFIFdd��Ducky2��Adobed��� Is there any way I can make PS use the format of the original JPEG when saving? If not, is there an...

Saving in jpeg format
Hi, I have a problem with PSP 8.01. When I try to save a file in jpeg standard format, PSP crashs. It does not really crashs, it justs does not answer anymore and I have to kill the task. Saving in progressive encoding works though... Anyone has an idea why ? Thanks Not sure, but it might have something to do with EXIF info. Are you editing photos? "Silivren Eryn-Duin" <privacy@nospam.net> wrote: >>Hi, >> >>I have a problem with PSP 8.01. When I try to save a file in jpeg standard >>format, PSP crashs. It does not really crashs, it justs doe...

Annotate and save a JPEG image
I have various JPEG files that I would like to manipulate in Tcl. I can read them in fine via the Img extension. What I want to do is read in an image, add a bit of size to the height. In this added part of the image, I want to put text. Basically I want to add a space under an image and put text there. I need to save this as a new JPEG. I know how to read the image, make another that is some amount taller, and copy the image into this bigger image. What I can't see is how best to get text into the image. I want the text in the new bit I am adding. So I have been looking how I can use ph...

How to save a figure as jpeg image
Hi All, I want to save my plots as jpeg (via Matlab code itself). After Plotting if i do 'hgsave' it saves my plot in the default MATLAB figure format (.fig), I want to save them as jpeg images. Thanks, Elan "Elangovan " <ea39@njit.edu> wrote in message <h4s68t$n7b$1@fred.mathworks.com>... > Hi All, > > I want to save my plots as jpeg (via Matlab code itself). > After Plotting if i do 'hgsave' it saves my plot in the default MATLAB figure format (.fig), I want to save them as jpeg images. > > Thanks, > Elan a hint: help p...

save image in Analyze format
Hi, I want to use Statistic Parametric Mapping (SPM) package to do statistics analysis for two 3D medical images. Before I can do that, I perform image processing on these images using Matlab. Because SPM requires Analyze format image, does anyone know how to transform Matlab image (.img) into Analyze format (or DICOM format)? Thanks for help. Jay Chen ...

How to save jpeg image in matlab?
Hi guys, thanks for dropping by.. Can someone advise me on how to save a jpg image in my matlab gui? I managed to capture an image inside an axis and i've got a separate button that says save. I just am not sure how to link the pic and the button together.. i need to be able to save the picture. Im new to matlab! Thanks so much for popping by.. Cheers Rina Rina wrote: > > > Hi guys, thanks for dropping by.. Can someone advise me on how to > save > a jpg image in my matlab gui? I managed to capture an image inside > an > axis and i've got a separate button th...

How to save greyscale image as jpeg?
Anyone know how to save a greyscale image as a jpeg in labview? &nbsp; Hi Jonathan, If I understand you correctly, you had a greyscaled image, which you applied color to and now want to save this new image.&nbsp; Before I jump into possibly solutions, I have a question for you.&nbsp; Are you using any IMAQ, Motion, or Vision VIs?&nbsp; If not, try using the Picture Control VIs - specifically, the "Write JPEG File.VI" If that won't work, please post a small piece of code illustrating the issue. Thanks! Janell Rodriguez | Applications Engineer | National Instrumen...

Save an image in raw format
Hello everybody!I'm trying to make a function which implements the standard JPEG with a given quality L. In order to discover if it does work I'd like to save an image matrix to a file.y,so I can compare it with a .jpeg file. How to do such a thing?Imwrite has no options for raw format... On May 13, 8:02=A0am, "Matman86 Di" <pasqui.squ...@email.it> wrote: > Hello everybody!I'm trying to make a function which implements the standa= rd JPEG with a given quality L. > In order to discover if it does work I'd like to save an image matrix to = a file.y,so I can...

JPEG: image file format
Hello to everyone! After the damage of my hard disk, i have lose many files including some unbackupped photo which i need to recover. I've tried to use many data recover tools and programs and i have restored many JPGs, which are indeed unreadable for many image viewers (i've tried with acdsee 3.0 and photoshop CS). At this point i need to develop a little java application to reconstruct the missed/faulted part of the JPG header to try to visualize (and after save) this images. Many times ago, i've developed a similar java application to open the bmp files, which was have a "b...