Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.help Subject: Re: Work around requested Date: Tue, 20 Dec 2011 16:53:25 -0800 Organization: A noiseless patient Spider Lines: 96 Message-ID: References: <17844998.127.1324178380897.JavaMail.geo-discussion-forums@pril5> <4decc207-ebaa-4d1c-9952-b73f18817f08@k10g2000yqk.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 21 Dec 2011 00:53:25 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="mz/LDSJwiWnk3Jnnqg7x+Q"; logging-data="10918"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GIkwGu+vDf0qtZlqMMFhS" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <4decc207-ebaa-4d1c-9952-b73f18817f08@k10g2000yqk.googlegroups.com> Cancel-Lock: sha1:UMe5NsZfQET2A/c+YXpUnoG6Vbo= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:1460 On 12/20/2011 3:46 PM, bH wrote: > On Dec 19, 12:01 am, bH wrote: >> On Dec 18, 1:36 am, "John B. Matthews" wrote: >> >> >> >> >> >>> In article >>> <17844998.127.1324178380897.JavaMail.geo-discussion-forums@pril5>, >> >>> Lew wrote: >>>> bH wrote: >>>>> I have jdk1.7.0, using a Windows7 machine. >>>>> I am working on a program >>>>> that will reduce a jpeg image to a >>>>> Thumbnail sized jpeg image. My program sample >>>>> uses these three imports, >>>>> among others. They are: >> >>>>> import com.sun.image.codec.jpeg.JPEGCodec; >>>>> import com.sun.image.codec.jpeg.JPEGEncodeParam; >>>>> import com.sun.image.codec.jpeg.JPEGImageEncoder; >> >>>>> my IDE lists the error as >>>>> "package com.sun.image.codec.jepg does >>>>> not exist." >> >>>>> Is there a work around that will do the same thing >>>>> but without these import listed above? >>>>> TIA for your reply. >> >>>> No. >> >>>> We'll assume the misspelling in your post was a typo and that you did >>>> not copy and paste the message. >> >>> Good point; exact, quoted error messages are also a good search target. >> >>>> The existence or non-existence of a package does not depend on your >>>> 'import' directives. >> >>>> You have not provided the correct classpath to the compiler for it to >>>> detect the needed package. >> >>> I recently installed 1.7.0_02, and I can see them in either NetBeans or >>> the command line with the classpath option, e.g.: >> >>> javap -classpath "\Program Files\Java\jdk1.7.0_02\src.zip" com.sun.image.codec.jpeg.JPEGCodec >> >>> The bigger problem is that these classes may not be available in future >>> releases. You might want to look at removing the dependence. The >>> classes javax.imageio.ImageIO and java.awt.image.AffineTransformOp may >>> be all you need. >> >>> -- >>> John B. Matthews >>> trashgod at gmail dot com >>> - Hide quoted text - >> >>> - Show quoted text - >> >> Hi All, >> Thanks for your help and suggestions. >> The workaround is now complete. >> bH- Hide quoted text - >> >> - Show quoted text - > > Hi All, > I compared the output using one large image > 1600 x 1200 pixels cropped to 200 x 150 in both > programs, first program uses: > com.sun.image.codec.jpeg.JPEGCodec > and the second program with the revision as suggested > above by John Matthews: > uses the classes javax.imageio.ImageIO and > java.awt.image.AffineTransformOp. > > The comparison result is that the suggested > revision by John Matthews comes in second place. > It does do crop it, but is less perfect of a > crop than the first method listed. > For instance in the second program, > the image is not as sharp and clear. > > bH My guess would be that AffineTransormOP uses those very same CODECS. There are several options that can be specified to tune the result. Why don't you post your code and a sample image. -- Knute Johnson