Compress or resize image in jpg format?

Hi guys,
I am developing a video rental web application using JSF, Spring, Hibernate and Tomcat 5. The administrator is able upload image. One of the page is to display a list of available DVD for rental just like ebay product listing page. The problem is that the administrator always upload the image with file size around 100K to 200K bytes and cause slow loading on the listing page, which will display 20 records (20 images). So if 100K bytes per image mean 2MB of images to download.
I am wondering how to compress and resize the image to a smaller resolution once the administrator uploaded the image. I saw eBay that each image is just 2Kbytes an image on the listing page.
Please forgive me if i ask in the wrong forum as i really don't know where to ask. Thank you !!
regards,
kmthien

You can do that in Java (you may need to use the -Djava.awt.headless=true option when running the server on headless Unix systems)....
You can use javax.imageio.ImageIO to read an image file to a java.awt.image.BufferedImage object, and write one back out to a JPEG file. And you can create a new BufferedImage simply and draw the original image at a new size on it, then save it. There's plenty of examples around the forums of doing all of that.

Similar Messages

  • How can i convert CR2 images into jpg format, without iPhoto?

    i just import a lot of images with the format .CR2 to mac through "Image capture" is there an app to convert the frmat into .jpg, app like image capture or something like that?

    If Canons software doesn't work...?
    Try Snap Converter, File Juicer or Contenta Converter

  • Exporting images in jpg format...

    Hello everyone,
    For some reason my iphoto is not able to export jpg format images, while initially it was doing so without any glitch whatsovever.
    Any idea/solution???
    Please help!!
    Thank You.

    in iPhoto select the photo(s) and export (file menu ==> export) as a JPEG
    (select photos & export)
    Are you exporting as JPEG as suggested?
    it's not recognising my jpg files.
    What is "It" that does not reconise the JPEGs you exported from iPhoto? have you tried Preview?
    LN

  • Color of Image in tiff format

    Hi all,
    i have converted the image  from JPG format to tiff format but the color is not coming in the tiff format although i have put the  BCOL where color option comes.....
    Please suggest..
    Thanks in Advance
    Ashu SIngh

    I have a similar problem, my TIF picture is 256 color and I upload it with BCOL option, but when printed on the form it's black/white, see below:
    20.10.2009           Uploading TIFF Files to SAPscript Texts                   1
    Load File
    c:\temp\cc.tif
    The file contains     49.434  bytes
    This is a TIFF file with INTEL byte order
    First IFD offset:                                   49.160
    Reading IFD from offset     49.160  Number of Tags         15
    ImageWidth:                                            128
    ImageLength:                                           128
    BitsPerSample levels:                                    3
    BitsPerSample - level 1:                                 8
    BitsPerSample - level 2:                                 8
    BitsPerSample - level 3:                                 8
    Compression:                                             1
    Photometric Interpretation:                              2
    Number of StripOffsets:                                  7
    SamplesPerPixel:                                         3
    RowsPerStrip:                                           21
    Number of StripByteCounts:                                7
    XResolution:                                             0  /          1
    YResolution:                                             0  /          1
    ResolutionUnit:                                          2
    This is a baseline TIFF 6.0 *FULLCOLOR* file
    TIFF raster image resolution in DPI:                    300
    Using resolution from report parameter:                 300
    Text ZHEX-MACRO-TEST1 , Language HR, Object TEXT , Id ST ,
    saved successfully

  • I am on windows 8 platform, i used adobe elements to work on my image - the output is in dng format, how do i convert this to jpg format?

    i am on windows 8 platform, i used adobe elements to work on my image - the output is in dng format, how do i convert this to jpg format?

    When you make a DNG that's like making another raw file, so you will need to convert the DNG file just like your original raw. Don't use the Save button in the raw converter. That's just a link to the DNG converter. Normally you would click Open instead and then save in the editor as a jpg or other image format of your choice.

  • SQL query, function or SP for converting varbinary to image(.jpg format).

    Dear Sir/Mam
    I want SQL query, function or SP which converts binary data to image (.jpg format).
    I m able to convert image (.jpg format) to varbinary. But not able to convert vice versa.
    thanks in advance.

    Binary data is binary data - "image" is only an intrepretation of binary data.  Therefore your question makes little sense in the context of sql server since it does not have any facilities to utilize images.  Since you provide no context, I'm
    guessing that you are trying to retrieve an image stored in the database in a varbinary column and have your application use it as an image.  If so, you should post your question to a forum that is specific to your development environment.  

  • Resize image code doesn't work for some JPGs

    Hi. I'm using the below code to resize images and store them on the server. However, with some JPGs, the resize produces a reddish tint on the image. Any ideas what could be causing this? Here's the original image: http://www.unctv.org/tWxkBbq_10M6wKRRL/PNCWWD01.jpg and here's what it produces afterward: http://www.unctv.org/tWxkBbq_10M6wKRRL/PABDFC01__1289231445291.jpg
    Photoshop CS5 is used to produce the JPG input for this app. Thanks.
    public BufferedImage resizeVeryHigh(InputStream inputStream, File resizedFile) throws IOException {
      BufferedImage bufferedImage = null;
      try {
          Image newImage = ImageIO.read(inputStream);
          int newWidth = (int)this.targetWidth;
          ImageIcon imageIcon = new ImageIcon(newImage);
          Image image = imageIcon.getImage();
          Image resizedImage = null;
          int iWidth = image.getWidth(null);
          int iHeight = image.getHeight(null);
          // This code ensures that all the pixels in the image are loaded.
          Image temp = new ImageIcon(resizedImage).getImage();
          // Create the buffered image.
          bufferedImage = new BufferedImage(temp.getWidth(null), temp.getHeight(null), BufferedImage.TYPE_INT_RGB);
          // Copy image to buffered image.
          Graphics g = bufferedImage.createGraphics();
          // Clear background and paint the image.
          g.setColor(Color.white);
          g.fillRect(0, 0, temp.getWidth(null), temp.getHeight(null));
          g.drawImage(temp, 0, 0, null);
          g.dispose();
          // Encodes image as a JPEG data stream
          FileOutputStream out = new FileOutputStream(resizedFile);
          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
          JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bufferedImage);
          param.setQuality(1.0f, true);
          encoder.setJPEGEncodeParam(param);
          encoder.encode(bufferedImage);
      catch (Exception e) {
            this.error = e.getMessage();
          return bufferedImage;
    }Edited by: oneworld95 on Nov 8, 2010 11:34 AM

    I don't know anything about the jpeg encoders, but I do see code that doesn't make any sense to me:
    Image resizedImage = null;
    int iWidth = image.getWidth(null);
    int iHeight = image.getHeight(null);
    // This code ensures that all the pixels in the image are loaded.
    Image temp = new ImageIcon(resizedImage).getImage();What is the point of creating an ImageIcon from a null image?
    int newWidth = (int)this.targetWidth;I don't see where you actually use this variable, so how does the image get resized?
    For more help create a [url http://sscce.org]SSCCE, that demonstrates the incorrect behaviour and maybe someone will take a look at it.

  • Converting an image as a blob content from .gif format to .jpg format

    Hi
    Does anyone know how to convert a blob content from .gif format to .jpg format?
    I've tried looking at the process-method of intermedia, but I can't figure out how it's supposed to work... I'm on a 10.2.0.2 standard edition database
    I simply have a blob containing a gif-image, and I want it to be convertet to a jpg-image for further use
    Can anyone help?
    Thank you
    /Klaus Mogensen

    Hi
    Does anyone know how to convert a blob content from
    .gif format to .jpg format?
    I've tried looking at the process-method of
    intermedia, but I can't figure out how it's supposed
    to work... I'm on a 10.2.0.2 standard edition
    database
    I simply have a blob containing a gif-image, and I
    want it to be convertet to a jpg-image for further
    useWhat OS is the database running on? If it is a *nix flavour, you can call out to image magick convert utility (it is pre-installed on most linux variants, and you can compile it from source for other unixes). So you would probably store the blob into a temp file on the database server, call out to the shell to execute convert, and then load a blob from the converted file. See http://imagemagick.org for more information.
    If that is not an option, you might be able to use Java Advanced Imaging API from a Java stored proc to convert between those image formats. See http://java.sun.com/products/java-media/jai/downloads/download-1_1_2.html
    gojko adzic
    http://gojko.net

  • HT4236 Why will my iPod not sync all the photos I want it to - I get a message saying that it cant display certain images.  All my photos are in jpg format and similar size.

    Why will my iPod touch not sync all the photos I want it to.  I get a message saying it cant display some of my photos.  They are all in jpg. format and similar size. Never had any problems before!
    Thanks

    That sounds exactly like an issue that has plagued McAfee users for around a year.
    Try disabling email scanning in your anti virus program.

  • Browser should show ALL images, in all formats.

    I recently opened an image for editing from Lightroom to Photoshop, corrected some perspective distortion, and saved the result as a PNG.  Lightroom then failed to show the new image, even after I synchronized the folder.  A respondent in the Lightroom forum said that Lightroom doesn't support PNG, to which I ask, WTF?
    Lightroom should support any format supported by Photoshop.  It displays JPEGs, which aren't a raw format.  Exactly how many products should we have to run concurrently to simply manage images?  Lightroom is supposed to be the product that does it, but if it fails to show all images in each directory, it fails at its purpose.

    MikeLeone wrote: So you think LR should support BMP? PCX? How many cameras store their
    photos in these formats? PS supports them, but why should LR?
    I'll agree with support for PNG, at least as far as exporting, as some
    web sites like using this format rather than JPEG (although the
    reasons for using PNG aren't technical, but legal, AFAIK - licensing
    for using the JPG format - rather than something technical, like
    smaller file size, etc).
    Very true, though I am more arguing that LR should be able to leverage formats available to other Adobe products installed on the same machine more than anything.
    BMP and PCX, no most cameras don't use those formats *anymore*. But I remember having an old camera that took photos in BMP format (it may have been a webcam, but still a camera) which I have in my library from a long time ago. In my day job we still actually use applications that suprisingly enough can only display PCX images; though I never would intentionally keep anything in PCX.
    I think anything it is able to import it should be able to export; but again if you have it natively supported in the Adobe product or universally supported by the OS without additional codec installation it should be supported, even if it is something obscure as PCX.
    MikeLeone wrote:
    That should be a feature request for the camera manufacturers, then,
    shouldn't it? Ask them to share their non-published, proprietary
    drivers with Adobe? Or at the very least, publish an API so LR (and
    presumably, other programs) can call the code (presuming that the code
    is modular enough to be called by other programs, of course).
    Yeah, I understand that neither Canon nor Nikon are supporting DNG files straight out of the camera yet and both still maintain a propreitary formated RAW file, but I would suspect that generally a Canon .CR2 file doesn't change all that much if at all other than the camera identifier from a 20D to a 5D Mk II to the 7D for example.
    Why do current Lightroom users need to wait until Adobe releases 2.6 or 3.0 to be able to use Lightroom with their 7D?
    Why if Adobe releases a Camera RAW update for PS that includes the 7D does it still not work in LR?
    Yes the mfg. need to be more open or pick a standard and run with it, but it just seems excessive for Adobe not to play nice too.
    It is in Canon/Nikon/Adobe's best interest to play nice and share this information with Adobe. So I am betting they are not withholding it. I was getting Canon SDK notifications for the longest time and sometimes months before a Camera was available, and sometimes it was even annouced this information was made available to developers on new camera models. I am sure Nikon does the same thing and Adobe is getting this information from all mfg.
    Christopher

  • Error message when uploading book for printing. All images are jpg and rgb. Could they be too large to upload? What size is required and how do I reduce size in Aperture?

    I receive an error message when I upload my book for printing. Not sure what the problem is. All my images are jpg and rgb. Could they be too large as it takes about 15minutes to upload to Apple. How do I reduce the size of the image in Aperture?

    Hi Leonie,
    Thanks for your reply.
    Error message below. The preview is fine . I can discount the first 2messages as its a new computer so plenty of disk space and upload doesn't seem to be interrupted. I have uploaded to iphoto before. have tried to upload 3times with the same error message. I had to photo my slides with a Kaiser Baas photo maker , which apparently doesn't scan but takes photos in megapixels of the slides. I am wondering now if the format is incompatible though they are jpg files or the colour type wrong. The image files are  around 1-3 mb each and  72 ppi. I think  I will now scan them properly with a scanner to 300dpi anyway to improve quality.
    Apple  talks about image files not being too big for uploading but gives no sizing of what too big is?
    Error message
    1. Upload Error. Loss of connection or file corruption during order upload may cause an incomplete order. Resubmitting your order usually resolves this issue.
    2. Low Disk Space. If your computer is running on low disk space, your files may be assembled incorrectly. Create more space by deleting unused files.
    3. Unreadable PDF file or image files. Files are sometimes assembled incorrectly due to CMYK or Grayscale color space. Use the RGB color space for best results.

  • When saving a file in [.jpg] format, i am asked to choose a quality from 1 to 100. what changes in the file created based on the quality parameter chosen?

    when saving a file in [.jpg] format, i am asked to choose a quality from 1 to 100. what changes in the file created based on the quality parameter chosen?. i would like to know what changes, so in the future i can set my camera to a setting that will give me the highest quality to begin with,allowing me to make crops and still preserve the quality.
    thank you
    dovid

    It's the level of compression. Lower number, more aggressive compression, more visual artifacts.
    Aside from that you should never use jpeg as a working format. The compression is destructive and cumulative, and the file deteriorates every time you resave it.
    Use TIFF or PSD, and if you need jpeg save out a copy as a single final step.

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?
    thanks!

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

  • How to save an image in different format

    i want to save an image in different format (as .jpg ,.gif, .tiff, .png, .bmp) using save dialog box , where format should come in drop box menu "Save as type" in save dialoge box.what to do.???????plz any one suggest me .........

    alok_raj wrote:
    i want to save an image in different format (as .jpg ,.gif, .tiff, .png, .bmp) using save dialog box , where format should come in drop box menu "Save as type" in save dialoge box.what to do.???????plz any one suggest me .........1) Spell words properly. That word is 'please'.
    2) Fix your sticky keyboard for the '?' and '.' keys. Only one of those characters is generally needed to denote a question or the end of a sentence. Two or more often denotes a dweeb.
    I might come back to your question later, assuming I can actually bare looking at that mess long enough to figure out what you want.

  • Upload and Resize Image not inserting filename in database

    I have a form that I created using the insert record form wizard. One of the fields is a file field and my form enctype is set to multipart/form-data. I then used the upload and resize image behavior and set the parameters. When testing the form the file uploads to the correct directory but no entry is made into the database for that particular field. The other fields are entered into the database just fine. If it helps, here is the code generated before the  tag:
    <br />
    <br /><?php require_once('../../Connections/test.php'); ?>
    <br /><?php<br />// Load the common classes<br />require_once('../../includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('../../includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("../../");<br /><br />// Make unified connection variable<br />$conn_test = new KT_connection($test, $database_test);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />//start Trigger_ImageUpload trigger<br />//remove this line if you want to edit the code by hand <br />function Trigger_ImageUpload(&$tNG) {<br />  $uploadObj = new tNG_ImageUpload($tNG);<br />  $uploadObj->setFormFieldName("picture");<br />  $uploadObj->setDbFieldName("picture");<br />  $uploadObj->setFolder("../images/");<br />  $uploadObj->setResize("true", 120, 0);<br />  $uploadObj->setMaxSize(1500);<br />  $uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png, bmp");<br />  $uploadObj->setRename("auto");<br />  return $uploadObj->Execute();<br />}<br />//end Trigger_ImageUpload trigger<br /><br />// Make an insert transaction instance<br />$ins_team = new tNG_insert($conn_test);<br />$tNGs->addTransaction($ins_team);<br />// Register triggers<br />$ins_team->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");<br />$ins_team->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$ins_team->registerTrigger("END", "Trigger_Default_Redirect", 99, "../team.php");<br />$ins_team->registerTrigger("AFTER", "Trigger_ImageUpload", 97);<br />// Add columns<br />$ins_team->setTable("team");<br />$ins_team->addColumn("id", "NUMERIC_TYPE", "POST", "id");<br />$ins_team->addColumn("sort", "NUMERIC_TYPE", "POST", "sort");<br />$ins_team->addColumn("name", "STRING_TYPE", "POST", "name");<br />$ins_team->addColumn("title", "STRING_TYPE", "POST", "title");<br />$ins_team->addColumn("description", "STRING_TYPE", "POST", "description");<br />$ins_team->addColumn("picture", "FILE_TYPE", "FILES", "picture");<br />$ins_team->setPrimaryKey("id", "NUMERIC_TYPE");<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rsteam = $tNGs->getRecordset("team");<br />$row_rsteam = mysql_fetch_assoc($rsteam);<br />$totalRows_rsteam = mysql_num_rows($rsteam);<br />?>

    If the reason is about memory, warning message should be happened when upload the image, because "show thumbnail" means resize at second time, how come you failed to resize the picture that system let it upload succeed at the first time by the same resize process?
    upload procedure
    a.jpg: 2722x1814, 1.2mb
    upload condition: fixed width 330px, 1.5mb
    "upload and resize" a.jpg -> file upload -> "resize engine" -> passed (but not work and no warning message)
    "show thumbnail" a.jpg -> "resize engine" -> failed (not enough memory)
    it doesn't make sense.
    and you miss an important key point, I upload the same picture myself, and resize work, so I said it happened at random, and that's why I am so worried.

Maybe you are looking for