Hi, I use the JPEG.Writer from the ‘JPEG’
bundle in the public repository to create a JPEG file. I use the following expression: (JPEG.Writer yCbCr) write: anImage
to: aFilename It creates a .jpg file, but the quality is a bit too
low: it throws away too much detail. Is there a way to configure the writer to make it
produce higher quality JPEGs? Thanks, Mark _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi Mark,
its been a while since I wrote it, so I may be a little imprecise here. IIRC the compression factor of JPEG is related to the quantization tables used in the compression phase. The #yCbCr initializes the writer with the standard tables provided by the JPEG specification, so if you want different resolution (which means different compression ratio) you would have to use other tables (see the QuantizationTable class and 'examples' class category). The basic idea is that the numbers in the table are used to weight how much the encoder should care about a given value in its colour space (the bigger the number, the less resolution it gets). I think that: http://en.wikipedia.org/wiki/JPEG and http://www.impulseadventure.com/photo/jpeg-quantization.html are good starting points to look at it. I'm really sorry but I can't work on an extension to set the quality of the output right now, but I did a quick test of using both tables without any color loss and I got bigger images than the ones created with the standard tables (3:1 ratio), so I suppose their quality should be better. I guess that using other tables (e.g. from Photoshop) should do the trick. In the meantime, you could try with: chrominanceNoLossTable ^self id: 1 values: #[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]. luminanceNoLossTable ^self id: 0 values: #[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]. and see if your images improve in quality. If so, then you would have to do the tables fine tune. Please, let me know if this works. Good luck! HTH, andrés Mark Plas escribió: > Hi, > > I use the JPEG.Writer from the 'JPEG' bundle in the public repository to create a JPEG file. > > I use the following expression: > > (JPEG.Writer yCbCr) write: anImage to: aFilename > > > It creates a .jpg file, but the quality is a bit too low: it throws away too much detail. > > Is there a way to configure the writer to make it produce higher quality JPEGs? > > Thanks, > Mark > > > > ------------------------------------------------------------------------ > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi Andrés,
Thank you for this information. I've used your 'no loss' tables and they produce much better results (as would be expected). I'm going to check out the quantization tables on the website you referred to, to see what compression ratios I can achieve while still having enough quality left over. Thanks again, Mark -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Andres Fortier Sent: woensdag 18 juni 2008 18:55 To: VWNC List Subject: Re: [vwnc] JPEG bundle in public repository/Quality setting? Hi Mark, its been a while since I wrote it, so I may be a little imprecise here. IIRC the compression factor of JPEG is related to the quantization tables used in the compression phase. The #yCbCr initializes the writer with the standard tables provided by the JPEG specification, so if you want different resolution (which means different compression ratio) you would have to use other tables (see the QuantizationTable class and 'examples' class category). The basic idea is that the numbers in the table are used to weight how much the encoder should care about a given value in its colour space (the bigger the number, the less resolution it gets). I think that: http://en.wikipedia.org/wiki/JPEG and http://www.impulseadventure.com/photo/jpeg-quantization.html are good starting points to look at it. I'm really sorry but I can't work on an extension to set the quality of the output right now, but I did a quick test of using both tables without any color loss and I got bigger images than the ones created with the standard tables (3:1 ratio), so I suppose their quality should be better. I guess that using other tables (e.g. from Photoshop) should do the trick. In the meantime, you could try with: chrominanceNoLossTable ^self id: 1 values: #[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]. luminanceNoLossTable ^self id: 0 values: #[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]. and see if your images improve in quality. If so, then you would have to do the tables fine tune. Please, let me know if this works. Good luck! HTH, andrés Mark Plas escribió: > Hi, > > I use the JPEG.Writer from the 'JPEG' bundle in the public repository to create a JPEG file. > > I use the following expression: > > (JPEG.Writer yCbCr) write: anImage to: aFilename > > > It creates a .jpg file, but the quality is a bit too low: it throws away too much detail. > > Is there a way to configure the writer to make it produce higher quality JPEGs? > > Thanks, > Mark > > > > ------------------------------------------------------------------------ > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi Mark,
great! Thanks for the feedback. There are many tables in the web site and you can also select two different ones and compare them, so I guess you should find the one more suitable for you relatively quick. I would really appreciate if you could share your findings afterwards, so that I can add different pre-setted configurations to the writer. Thanks! Andrés Mark Plas escribió: > Hi Andrés, > > Thank you for this information. I've used your 'no loss' tables and they produce much better results (as would be expected). I'm going to check out the quantization tables on the website you referred to, to see what compression ratios I can achieve while still having enough quality left over. > > Thanks again, > Mark > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Andres Fortier > Sent: woensdag 18 juni 2008 18:55 > To: VWNC List > Subject: Re: [vwnc] JPEG bundle in public repository/Quality setting? > > Hi Mark, > its been a while since I wrote it, so I may be a little > imprecise here. IIRC the compression factor of JPEG is related to the > quantization tables used in the compression phase. The #yCbCr > initializes the writer with the standard tables provided by the JPEG > specification, so if you want different resolution (which means > different compression ratio) you would have to use other tables (see > the QuantizationTable class and 'examples' class category). The basic > idea is that the numbers in the table are used to weight how much the > encoder should care about a given value in its colour space (the > bigger the number, the less resolution it gets). I think that: > http://en.wikipedia.org/wiki/JPEG > and > http://www.impulseadventure.com/photo/jpeg-quantization.html > > are good starting points to look at it. > > I'm really sorry but I can't work on an extension to set the quality > of the output right now, but I did a quick test of using both tables > without any color loss and I got bigger images than the ones created > with the standard tables (3:1 ratio), so I suppose their quality > should be better. I guess that using other tables (e.g. from > Photoshop) should do the trick. > > In the meantime, you could try with: > > chrominanceNoLossTable > > ^self > id: 1 > values: #[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]. > > > luminanceNoLossTable > > ^self > id: 0 > values: #[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]. > > and see if your images improve in quality. If so, then you would have > to do the tables fine tune. Please, let me know if this works. > Good luck! > > HTH, > andrés > > Mark Plas escribió: >> Hi, >> >> I use the JPEG.Writer from the 'JPEG' bundle in the public repository to create a JPEG file. >> >> I use the following expression: >> >> (JPEG.Writer yCbCr) write: anImage to: aFilename >> >> >> It creates a .jpg file, but the quality is a bit too low: it throws away too much detail. >> >> Is there a way to configure the writer to make it produce higher quality JPEGs? >> >> Thanks, >> Mark >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |