-
The Dimension of an Image file
How can I verify the dimension of an Jpeg or Gif file that I have in my server
directory (e. g c:/Dir/image.jpeg) within a servlet.
I want to verify the dimension before make the output.
Thanks in advance
Mohamed
-
Re: The Dimension of an Image file
Heres an example of resizing an image, pull out the bits that you
need....notice the getWidth, getHeight methods.
public void yoImage() {
MediaTracker media = new MediaTracker(this);
source = getImage(getDocumentBase(),"image.gif");
media.addImage(source,0);
try {
media.waitForID(0);
// scale down, half the original size
ImageFilter replicate =
new ReplicateScaleFilter
(source.getWidth(this)/2, source.getHeight(this)/2);
ImageProducer prod =
new FilteredImageSource(source.getSource(),replicate);
resizedImage = createImage(prod);
media.addImage(resizedImage,1);
media.waitForID(1);
}
catch(InterruptedException e) {}
}
--
Regards
John Timney
Microsoft MVP
(http://support.microsoft.com/support/mvp/program.asp)
Co-Author Professional JSP
ISBN: 1-861003-62-5
Mohamed Abu Zur <mabuzur@medifusion.com> wrote in message
news:39d21b7e$1@news.devx.com...
How can I verify the dimension of an Jpeg or Gif file that I have in my
server
directory (e. g c:/Dir/image.jpeg) within a servlet.
I want to verify the dimension before make the output.
Thanks in advance
Mohamed
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks