Optimize JPG image size reduction by reduced compression quality vs. reduced pixels?

I have many images of slides scanned at high res (4800 DPI, maximum pixels 5214x3592).   Although I will be saving these as lossless TIFs, I also wish to make JPGs from them that I wish to be just less than 5 MB in file size.  Aside from cropping, I know I can achieve such a reduction of JPG file size by a combination of saving to lower quality JPG compression or reducing image size.  My question is, what is theoretically or practically better, achieving this mostly by reducing image total pixels or by reducing  JPG compression quality.  Thank you

Thank you Doug.  The comments on extensive uniform blue sky vs. marked variation in color seem well taken, I'll keep this method of choosing in mind.  My goal is to create a JPG family photo archive of the highest quality images that I can make for future use by non-technical descendants (thus it will supplement the TIF archive that holds the best quality versions of the same images but that may not be usable to novices).  As I cannot anticipate exactly how the JPGs will be used, I just want them to be the best possible, while still being of a size that can be uploaded to, say, Costco (5 MB size limit) for making enlargements. 
In general, I am often left curious as to how exactly Photoshop carries out its algorithms and how different factors influence the outcome.  So often, one read "just try different techniques and see what looks the best".  But I am always left wondering, what is the theory behind this and has it been systematically studied and worked out and published.  In so many disciplines, such as medicine, the methods of optimization has been evaluated, systematized, and fully described.  I have not yet explored what may be found in technical journals, but I'm sure much of this good stuff must be available somewhere. It would be nice to have a "How Things Work" that actually explains what Photoshop is doing under the hood.
Thanks again.

Similar Messages

  • Image Size reduction and gain resolution... Help?

    I have searched the forums and seen plenty of talk of Image Size and resolutions but havent stumbled upon what I need.
    Hopefully someone will be nice enough to help me or to link me to help?
    I have a large photo (3456x2304) but it is at 72ppi.
    I am trying to use it as a very small image (200px or so) but I need it at 300ppi.
    I keep going into Image Size and reducing its dimensions to the size I need and marking 300dpi.
    Problem is when it resizes it gets horribly pixelated!!!
    I cant figure out how to use the image size and/or crop tool in order to reduce the dimensions and not lose quality.
    Best work around I have found is to reduce it to about 750px 72ppi and then in illustrator contract the image to the actual print size while gaining resolution...
    Any help would be greatly appreciated.

    There is a relationship between image size and ppi (resolution)  that can not be changed.  Here is an example from the web titled "understanding resolution".
    Let's say you have an image that is 9 inches wide and 6 inches high with a resolution of 240 pixels/ per inch (8.9mb file).  If you change one of the values the other two will change (resample image turned off).  In this example if you changed the width to 6 inches the height would become 4 inches and the resolution would become 360 ppi.
    So if you are taking a large image and reducing the size the ppi has to go up.  There are the same number of pixels in the picture, they are compressed into a smaller space.  The article says this is because a digital image has no absolute size or resolution.  All it has is a certain number of pixels in each dimension.
    Hope this helps.

  • Image size reduction without losing resolution

    I am creating marketing materials and product labels for my company using Elements 9. I am not a Photoshop expert but I have a reasonable knowledge of the program. I need to resize certain assets such as logos and paste them onto various documents. The problem I am having is that no matter what method I use to resize, they always lose resolution and appear pixelated and/or blurry in the final printed version.
    Normally I receive the assets in a hi-res image. It could be a jpeg or bitmap or any other number of format. I will open it in Elements, select it and remove the background via the Magic Wand>Layer Via Cut, and delete the background layer.
    From there, I have tried everything from the simple select, grab the corner and manually drag inwards method, to using Image>Resize>Image Size and filling in the fields. When I performed the latter, I typed in 300dpi, made sure Constrain Proportions was turned on, checked Resample, and selected Bicubic Sharper, and entered the size in inches. Then I copy/paste into the document, and it looks fine. I save, which normally opens up Reader and I print from there. The printed image looks great except for any logos I resized, which look awful. I also tried printing from within Elements, but it won't do it without giving me a message first saying that the document will print at less than 200dpi, which is obviously not desirable.
    One I paste the image onto the document, the Image Size>Resize becomes unusable because I can't seem to select just the logo - even with the bounding box clearly visable around the logo, resizing causes the entire document to be affected.
    I have tried many combinations of selecting/deselecting every option I can find, including Alias/Anti-Alias (which for some reason sometimes doesn't seem selectable at all). I've scoured forums and tutorials for help on this, and have tried every method I could find. In the end, nothing has worked. There has got to be a way to do this. Our 30 day trial is almost over and we went ahead and purchased the program without knowing whether we could resolve this issue - if we can't, it will be pretty much useless to us. Please help me so I can tell my boss he didn't just waste company money on this program!
    In short, my question is, what is the correct (or best) method for reducing image size? Please be detailed - and thank you! 

    Thanks for the reply Jon, but unfortunately I ended up with the same result as MTSTUNER said (using the Crop Tool).
    MTSTUNER, that definitely helped. The problem must have been in pasting, which as you said brings a "non-smart" image over. I was even able to resize a bit on the new document without losing any clarity whatsoever. Very helpful - THANK YOU!

  • Image size reduction

    HI
    my camera creates gi -huge files from it's 12mb sensor.
    In photoshop to reduce the size its flow is reduce the size and re sample and then sharpen.  I have 60 + images to do for a web site. I could create an  action but fireworks has it's batch option, Does this re interpolate and sharpen and is it as good or better than Photoshop?
    thanks
    Ian

    What are the pixel dimensions of these images? download a few to the desktop using image Capture (in your applications folder) and report the pixel dimensions of the originals
    Basically the answer is going to be that iPhoto makes no changes of any sort to the original - it makes a bit for bit copy - so we need more information to figure out what is going on - it is NOT iPhoto reducing the image size
    LN

  • Image size reduction is doing new and unwelcome things to my PNGs

    I've recently upgraded to Photoshop 6 from 5.5. My work involves taking large (1500-3000 pixels square) and reducing them to 256 or below. Upon upgrading to Photoshop 6 I started to notice that the images were looking a little harsher and less blended at the small sizes. I've attached a comparison of the image once it's been resized down to 192x in both programs. The original image can be found here: Image. As you can see, there is definitely a different style of blending going on that leads to a higher contrast at the borders between colors and lines.
    These images are used in a game, and the new CS6 images look worse on the iphone than the old ones. Does anyone recognize what's going on here and how to either fix or mitigate the issue? Any help or insight is much appreciated.

    Hi,
    How are you reducing the image size, i.e. Image>Image Size?
    If your using Image>Image Size, what method under Resample Image is choosen?

  • Transparent edge bug in image size reduction using bicubic

    I'm using Photoshop CS6 (64-bit) and ACR 7.1, all patched to the latest version today (13 June), and running Windows 7 64-bit. When I reduce the image size of an originally smart object using bicubic, the edges will be somewhat transparent, creating an ugly border around the image.
    Step 1: Open a raw file. ACR 7.1 will pop up. The raw file is a CR2 file produced by Canon EOS 7D. Workflow option: sRGB, 16 bit, 3888x2592.
    Step 2: Press shift+click the Open button to open it as smart object.
    Step 3. Right click the layer and choose rasterize layer. When you zoom the image, there is nothing wrong in the edges.
    Step 4: Resize the image (CTRL+ALT+I) for example to 300x200 using Bicubic resampling (bicubic auto, whatever).
    The edges (outermost 1 pixel) will be transparent! See attached image.
    This doesn't happen:
    * in photoshop cs5
    * if I use bilinear or other resampling
    * if I import the file from ACR to PS as a normal bitmap (not using shift+click)
    Anyone know what's going on here? My workflow involves opening files from Camera Raw as smart object, so if there is any workaround until the next patch I will be very glad.

    >> Are you sure?
    Yeah. I'm sorry, but why do you think I would write it if I didn't try it? I tried bilinear and nearest neighbor and they all work fine.
    And well considering the algorithms average neighboring pixels, with a naive implementation a transparent edge is expected i guess, but I expect photoshop cs6 to be just a little bit smarter than that.

  • Photo image : size reduction software

    HI !
    I want to reduce sizes of photo images i.e. jpeg, gif files of few GB's into less than 100KB. Need free / paid software compatible to MAC OS X 10.6.8.

    Do you really mean image files of a few Gigabites? I doubt there are many apps that can handle that size of an image file and the machine would have to have many GBs of memory to even consider using it? Was that a type and you mean a few MBs?
    Going from 2 GB down to 100 KB or less is nearly impossible and still get a decent image.  This is an 4.3 MB file compressed to 100 KB with no reduction in the image (pixels) size.
    This is the original file:
    Click on them to see what they look like full sized.  The edited version is showing pixelation in the sky and other areas.
    This was done with iResize at 15% quality (jpeg compression) level. It was the only file resize I had that would get it down below 300 KB.  Even Photoshop CS3 couldn't get it down below 230 KB.

  • How to reduce image size on photoshop without losing quality

    i have a logo that needs to be shrunk. but as soon as i shrink it the image looks pixelated. if i leave it as-is, the website says the size is too big. please advise.
    Dale Mundi

    When you reduce its size, you are removing pixels which is one of the reasons it can look pixelated. You could add a slight blur, but that may make it look worse.

  • Problems in placing .jpg images - size shrinks

    Hi,
    I have been working with InDesign for years and this is the first time I encouterred the following problem. Currently I am creating an online document with InDesign CS5.5.
    The problem is that when I place (ctrl + D) an image (.jpg), some of them seem to "shrink" from their original size and become totally pixelated.
    My original image is 192 x 380 px and it was placed as 46.08 x 91.2 px
    I don't understand what might be the problem. For some of my images it seems to do this and for some not. There are some images that I have previously placed succesfully and then these same images are now shrinked when I place them. Could this be a setting change? I have tried everything, but nothing seems to work.
    Very puzzled.
    Any suggentions?
    Miiagod

    A 192 x 380 pixel  image scaled at 100% that also measures 192 x 380 pixels on the ID page has to have an actual resolution of 72ppi:
    If the actual ppi is different (100 ppi below) and the scale is 100% then the ID object pixel width and height has to change:

  • What's the easiest way to resize/optimize an image size with the iPhone SDK?

    hi.......every one.
    I developed one APP in XCode4.6.3 ,it's working perfectly in ipad.
    After update my xocde 4.6.3 to 5.0 it is not working, it is crashes.
    How to Set an iamge for both ,ipad & ipad retina

    Hi Srikanth,
    if chitram.png is your image file for 1024 resolution iPad, then [email protected] will become image for retina iPad.
    Please have double resolution image ready for that.

  • How do you optimize an image?

    this seems easy and it should be, but for some reason i am having an issue. For my class we are suppose to optimize our images,
    this should be a simple thing, however, when i click on my image in fireworks and go into the optimize panel and change it, it doesn't
    change the image i have selected, but the entire document instead. so how do i make fireworks optimize the image i have selected, instead of the
    whole document? (we can't use any other program either, just fireworks, so no PS or anything else)

    You do your design work and save it to a native Fireworks .png file. This file format is an enhanced version of a standard .png file and contains the additional data for the vector objects, code exports, and other information that is specific to FW. Other programs that read .png files can read FW .pngs, but they will ignore the extra informations.
    When you want to produce output for the Web, you need to select an image type and optimize it, based on the image content. Your optimize settings will be saved when you save the FW document, but the document maintains its original data and does not change. It is the output file that gets optimized.
    To produce an image for the Web, you use export, instead of save. Personally, I like using the File>Image Preview... menu. From there, I can choose my output file type and the parameters for the file. There's also File>Export Wizard...
    If you decide you want to export to one of the .png formats, you need to be careful to export to a different file name from your working FW document, or you can overwrite your master file with a flattened file, losing all your work. I read a suggestion here to name FW documents as .fw.png as a reminder, but you still need to watch what you're doing.
    For file formats...
    JPEG stands for Joint Photographic Experts Group and this format is optimized for photographs or other images where the variation in color between adjacent pixels is low. When you optimize .jpg images, you have controls for compression/quality and also for adding sharpness.
    GIF is a good format when you have line art with few colors. This format uses a palette of 256 or fewer colors, one of which can be fully transparent. This format also can support animations.
    PNGs (bitmap) come in three versions. PNG24 is a full-color image with no transparency; the 24 bits are 8bits each of red, green, and blue. PNG32 is a full color image with full transparency; 8 bits each of red, green, blue, and alpha. PNG8 is a limited palette similar to the GIF, but you can have semitransparent colors.
    There appears to be a long-standing bug in Fireworks where, if you choose GIF or PNG8, Fireworks may not give you all the colors in your image. You can manually add colors using the eyedropper.
    Hope that helps!

  • Does photo size reduction for e-mailing degrade photos?

    In using iPhoto to send photos by e-mail one has the option of reducing the size of these photos from actual size to small, medium, or large size in order to transmit them more quickly, but what effect does this size reduction have on the quality of the photos?
    I suspect that the size reduction degrades the images, but I have not been able to obtain any sort of definitive information on this subject, even when I contacted Apple tech help. Is there some knowledgeable person on board who can give us the story on this issue?
    I like the idea of transmitting photos as fast as possible, but not if it means degrading the images by reducing their size to speed up the e-mail process.
    Bob

    Smtr,
    Thanks for your helpful reply. I wasn’t concerned about the original photo retained in my library, but only about the reduced-size copy transmitted by e-mail.
    I’m amazed at how much one can reduce the photo size for transmitting by e-mail. I just randomly selected a 3.3 MB JPEG image which can be squeezed down to only 63 KB by selecting the Small size in the Mail Photo window. I calculate that the reduced size photo would be only 1/52 the size of the original. I assume that the 63 KB image would be a very poor candidate for producing a print! I also assume that the 63 KB image, when viewed by the recipient on his monitor, would be a lot smaller than it would be if I sent him a copy at Actual Size.
    Suppose the the recipient’s e-mail system could not handle the Actual Size 3.3 MB photo, so I send him a Large copy (414 KB) or a Medium copy (122 KB). Would either of those reduced-size photos produce a decent print as small as 4 X 6? I am trying to get a feel for how far I could squeeze down the size of one of my photos for e-mail transmittal before it becomes unsuitable for producing even a small print.
    Comments?
    Bob

  • Incorrect Image Size Insert/Download into/from Database

    We have used the Oracle Forms6i version 6.0.8.18.3 to add picture by using the
    statement:
    read_image_file(get_file_name,'JFIF','s_image.image');
    The database used is Oracle 9i version 9.0.3.0
    The original picture is a JPEG file which is with 10,484kB file system size.
    After inserting into the database via the Forms6i, the size in database is
    2,152,740 Bytes only! Then we download this picture from the database into the
    local hard disk of a machine with Forms 6i statement:
    write_image_file('output.jpg','JFIF','s_image.image');
    The file 'output.jpg' is with 1,958,603 Bytes!!!
    We then examine the two files and found that the resolution of the original
    picture is 305dpi but the one downloaded from database is just 72dpi!
    We have the following property for the image item 's_image':
    image format: JFIF
    image depth: original or RGB
    compression quality: none
    display quality: high
    sizing style: adjust
    Please advise how to fix this problem, we should maintain everything the same
    as the original picture when inserting into the database. Much thanks.

    it is that you use Oracle util,
    when you read image from local disk ,image is translated to Oralce Form Formats!!!
    so when you re-write image to local disk ,the size must be change.

  • I cannot remove embedded barcode from the image. Due to saving compression.

    Hi guys,
    I recreate a thread to prevent confusing on my previous one. Please only reply to this thread thanks.
    Ok, for a start I will give some general description about the application I made.
    I had some problem with the image being compressed while it is saved.
    Because saving an image will cause it to compress and had its pixel valued changed, I could not successfully remove the bardcode that is embedded inside a image(although some of the pixel value will be returned to original normally). I had placed my code below and will accept any opinion that will help me solve the removal of barcode problem.
    What my application does is actually very simple. It will take the pixel value of the area inside the image that will be embed with the barcode first, then it will take the pixel value of the barcode and use the formula (1-alpha * Image pixel value) + (alpha * barcode pixel value) = new pixel value which will contain the barcode that had been embedded inside. The formula works great but when I saved the image the pixel value will change due to compression. On the removal of barcode my application will read every pixel value from the image embedded with barcode (only the area with barcode embedded), then it will go on to read every pixel value of the barcode used for embedding and then use the formula (Embedded image pixel value - (alpha * Barcode pixel value) - (1 - alpha) = original pixel value. But due to the reason that compression will change some of the pixel inside the saved image to drop in its value, the result from the removal formula will be negative and hence caused my result image to become wierd as it will red colors instead of original color on some of its pixel. I tried saving under PNG format which people said to be lossless compression but the result is still the same.
    So I need to ask you guys for opinion or help me find the part where I actually did wrongly and caused the image pixel value to change.
    Thanks. Please proceed and read below for the codes that I used. It is messy and I will sort it out later.
    When alpha is set as 1 the barcode will appear to be overwrite onto the image. But when alpha is set as 0.1 the barcode will appear to be transparent and almost seems to be not there on the image when embedded.
    This is the code I used to retrieve image pixel when embedding:
    public static int[] getImagePixelValue(BufferedImage image, int x, int y){
              //Create an array to store image RGB value
              int[] imageRGB = new int[3];
              //Get height and width from input image
              int imageWidth = image.getWidth();
              int imageHeight = image.getHeight();
              //Get raw RGB value from image
              int imageValue = image.getRGB(x, y);
              //Convert image raw RGB value
              int imageRed = ((image.getRGB(x, y) >> 16) & 0xff);
              int imageGreen = ((image.getRGB(x, y) >> 8) & 0xff);
              int imageBlue = image.getRGB(x, y) & 0xff;
              //Input the converted RGB value into the array
              imageRGB[0] = imageRed;
              imageRGB[1] = imageGreen;
              imageRGB[2] = imageBlue;
              /*//Print out the pixel value to check
              System.out.println("Image red pixel: "+imageRGB[0]);
              System.out.println("Image green pixel: "+imageRGB[1]);
              System.out.println("Image blue pixel: "+imageRGB[2]);*/
              //Return image RGB value
              return imageRGB;
    }This is the code I used to retrieve barcode pixel for embedding:
    public static int[] getWatermarkPixelValue(BufferedImage watermark, int x, int y){
              //Create an array to store watermark RGB value
              int[] watermarkRGB = new int[3];
              //Get height and width from input watermark
              int watermarkWidth = watermark.getWidth();
              int watermarkHeight = watermark.getHeight();
              int watermarkValue = watermark.getRGB(x, y);
              //Convert watermark raw RGB value
              int watermarkRed = ((watermark.getRGB(x, y) >> 16) & 0xff);
              int watermarkGreen = ((watermark.getRGB(x, y) >> 8) & 0xff);
              int watermarkBlue = watermark.getRGB(x, y) & 0xff;
              //Input the converted RGB value into the array
              watermarkRGB[0] = watermarkRed;
              watermarkRGB[1] = watermarkGreen;
              watermarkRGB[2] = watermarkBlue;
              /*//Print out the pixel value to check
              System.out.println("Watermark red pixel: "+watermarkRGB[0]);
              System.out.println("Watermark green pixel: "+watermarkRGB[1]);
              System.out.println("Watermark blue pixel: "+watermarkRGB[2]);*/
              //Return watermark RGB value
              return watermarkRGB;
         }This is the code I used for merging the image pixel and barcode pixel to get the embedded pixel value:
    public static int[] getEmbeddedPixelValue(int[] imagePixelValue, int[] watermarkPixelValue, double alpha){
              //Create a object to hold embedded pixel value
              int[] embeddedRGBValue = new int[3];
              //Change image pixel value into double calculating equation
              double imgRedValue = (double) imagePixelValue[0];
              double imgGreenValue = (double) imagePixelValue[1];
              double imgBlueValue = (double) imagePixelValue[2];
              //Change watermark pixel value into double calculating equation
              double wmRedValue = (double) watermarkPixelValue[0];
              double wmGreenValue = (double) watermarkPixelValue[1];
              double wmBlueValue = (double) watermarkPixelValue[2];
              //Equation for embedding image and watermark together
              double embeddedRed = ((1.0 - alpha) * imgRedValue) + (alpha * wmRedValue);
              double embeddedGreen = ((1.0 - alpha) * imgGreenValue) + (alpha * wmGreenValue);
              double embeddedBlue = ((1.0 - alpha) * imgBlueValue) + (alpha * wmBlueValue);
              //Changing embedded value from double to int
              int embeddedRedValue = (int) embeddedRed;
              int embeddedGreenValue = (int) embeddedGreen;
              int embeddedBlueValue = (int) embeddedBlue;
              //input the embedded RGB value into the array
              embeddedRGBValue[0] = embeddedRedValue;
              embeddedRGBValue[1] = embeddedGreenValue;
              embeddedRGBValue[2] = embeddedBlueValue;
              //Return embedded pixel value
              return embeddedRGBValue;
         }This is the code where I used for the embedding process:
    else if(target == embedButton){
                   String xCoordinate = JOptionPane.showInputDialog(embedButton, "Enter coordinate X", "When you want to embed the watermark?", JOptionPane.QUESTION_MESSAGE);
                   String yCoordinate = JOptionPane.showInputDialog(embedButton, "Enter coordinate Y", "When you want to embed the watermark?", JOptionPane.QUESTION_MESSAGE);
                   int xValue = Integer.parseInt(xCoordinate);
                   int yValue = Integer.parseInt(yCoordinate);
                   int wCounter = 0;
                   int hCounter = 0;
                   //Create file object to be used in embedding and removing watermark
                   File inputImage = new File(imagePath);
                   File inputWatermark = new File(watermarkPath);
                   //Convert string into double for calculation of embedded pixel value
                   try {
                        alphaDouble = Double.valueOf(alphaValue).doubleValue();
                   catch (NumberFormatException nfe) {
                        System.out.println("NumberFormatException: " + nfe.getMessage());
                   try{
                        //Define selected image as testPic and make java read the file selected
                        BufferedImage image= ImageIO.read(inputImage);
                        BufferedImage watermark= ImageIO.read(inputWatermark);
                        BufferedImage testing;
                        //Get height and width value from the selected image
                        int imageWidth = image.getWidth();
                        int imageHeight = image.getHeight();
                        //Get height and width value from the selected barcode
                        int watermarkWidth = watermark.getWidth();
                        int watermarkHeight = watermark.getHeight();
                        int totalWidth = watermarkWidth + xValue;
                        int totalHeight = watermarkHeight + yValue;
                        //Use nested for loop to get RGB value from every pixel that the barcode will be embedded in the selected image
                        if(totalWidth <= imageWidth && totalHeight <= imageHeight){
                             for (int h = yValue ; h < totalHeight; h++){
                                  for (int w = xValue; w < totalWidth; w++){
                                       int[] imagePixelValue = getImagePixelValue(image, w, h);
                                       int[] watermarkPixelValue = getWatermarkPixelValue(watermark, wCounter, hCounter);
                                       int[] embeddedPixelRGBValue = getEmbeddedPixelValue(imagePixelValue, watermarkPixelValue, alphaDouble);
                                       setRed(image, w, h, embeddedPixelRGBValue[0]);
                                       setGreen(image, w, h, embeddedPixelRGBValue[1]);
                                       setBlue(image, w, h, embeddedPixelRGBValue[2]);
                                       wCounter++;
                                       if(wCounter == watermarkWidth){
                                            wCounter = 0;
                                            hCounter++;
                        else{
                             JOptionPane.showMessageDialog(embedButton, "The watermark cannot be embedded at the coordinates.");
                        tempImage = image;
                        imageIcon = new ImageIcon(tempImage);
                        labelImage.setIcon(imageIcon);
                        imagePanel.add(labelImage);
                        container.add(imagePanel, BorderLayout.CENTER);
                        setVisible(true);
                        System.out.println("Embedding completed");
                   catch(Exception errorEmbedding){
                        //If there is any error, the try and catch function will tell you the error
                        System.out.println("The following error occured: "+errorEmbedding);
              }This is the code I use to save the image that had been embedded with the barcode:
    else if(target == saveAction){
                   JFileChooser chooser = new JFileChooser();
                   FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG & GIF Images", "jpg", "gif");
                   chooser.setFileFilter(filter);
                   chooser.setCurrentDirectory(new File("."));
                   int returnVal = chooser.showSaveDialog(getParent());
                   if(returnVal == JFileChooser.APPROVE_OPTION) {
                        String name = chooser.getSelectedFile().getAbsolutePath();
                        //Create a string instant to hold outputImage path name
                        String saveFile = chooser.getSelectedFile().getName()+"."+fileType;
                        //Create file output to decide what name will be used to save the file
                        File outputImage = new File(saveFile);
                        try{
                             //Save the file with the name used
                             ImageIO.write((RenderedImage) tempImage,fileType,outputImage);
                        catch(Exception errorSaving){
                             //If there is any error, the try and catch function will tell you the error
                             System.out.println("The following error occured: "+errorSaving);
                   else{
              }This is the code I used for removal process of barcode:
    else if(target == removeButton){
                   //Create file object to be used in embedding and removing watermark
                   File inputImage = new File("removalTesting.jpg");
                   //File inputWatermark = new File(watermarkPath);
                   //Used a defined barcode for testing of removing barcode from embedded image
                   File inputWatermark = new File("barcode.jpg");
                   /*//Convert string into double for calculation of embedded pixel value
                   try {
                        alphaDouble = Double.valueOf(alphaValue).doubleValue();
                   catch (NumberFormatException nfe) {
                        System.out.println("NumberFormatException: " + nfe.getMessage());
                   //Used a defined alpha value for testing of removing barcode from embedded image
                   //alphaDouble = 0.5;
                   //Create x and y value for the starting coordinates of barcode embedded in the embedded image
                   int xValue = 0;
                   int yValue = 0;
                   int wCounter = 0;
                   int hCounter = 0;
                   try{
                        //Define selected image as testPic and make java read the file selected
                        BufferedImage image= ImageIO.read(inputImage);
                        BufferedImage watermark= ImageIO.read(inputWatermark);
                        //Get height and width value from the selected image
                        int imageWidth = image.getWidth();
                        int imageHeight = image.getHeight();
                        //Get height and width value from the selected barcode
                        int watermarkWidth = watermark.getWidth();
                        int watermarkHeight = watermark.getHeight();
                        int totalWidth = watermarkWidth + xValue;
                        int totalHeight = watermarkHeight + yValue;
                        //Use nested for loop to get RGB value from every pixel that the barcode had been embedded in the embedded image
                        if(totalWidth <= imageWidth && totalHeight <= imageHeight){
                             for (int h = yValue ; h < totalHeight; h++){
                                  for (int w = xValue; w < totalWidth; w++){
                                       int[] imagePixelValue = getImagePixelValue(image, w, h);
                                       int[] watermarkPixelValue = getWatermarkPixelValue(watermark, wCounter, hCounter);
                                       int[] removedPixelRGBValue = getOriginalImagePixelValue(imagePixelValue, watermarkPixelValue, alphaDouble);
                                       setRed(image, w, h, removedPixelRGBValue[0]);
                                       setGreen(image, w, h, removedPixelRGBValue[1]);
                                       setBlue(image, w, h, removedPixelRGBValue[2]);
                                       wCounter++;
                                       if(wCounter == watermarkWidth){
                                            wCounter = 0;
                                            hCounter++;
                        tempImage = image;
                        imageIcon = new ImageIcon(tempImage);
                        labelImage.setIcon(imageIcon);
                        imagePanel.add(labelImage);
                        container.add(imagePanel, BorderLayout.CENTER);
                        setVisible(true);
                        System.out.println("Embedding completed");
                   catch(Exception errorEmbedding){
                        //If there is any error, the try and catch function will tell you the error
                        System.out.println("The following error occured: "+errorEmbedding);
              }Sorry if the codes are in a mess, I did not had the time to sort it out yet but most likely do it when I got the removal of barcode done.
    Follow this link to have a look of the result I see in my application when I got the barcode embedded into the image I selected:
    [http://img356.imageshack.us/my.php?image=beforeremovalresultmg2.jpg]
    Follow this link to have a look of the result I see in my application after I got the barcode removed:
    [http://img523.imageshack.us/my.php?image=removalresultmx4.jpg]
    As you can see from the link, after I remove the barcode from the image. Some of the pixel actually went back to normal in the barcode area when the the barcode is embedded into the image. But some pixel in the barcode area had its value changed due to compression when I save the image file I think.
    Anyone can help me find out the problem?
    Thanks.

    KamenRider wrote:
    I suspect the problem lies in the code when I save the image. Because people said that PNG was loseless compression but when I saved in PNG some of the pixel went back to normal while some did not. This is obviously the cause from changing of pixel value when I saved the image.You are almost certainly wrong. This is trivially easy to check. Print out the color of a certain pixel immediately before you save it. Open the saved PNG in your favorite image manipulation program and check the saved value of that same pixel. When you re-load the saved PNG, print out the color again. It should be unchanged.
    Thanks you for trying to help me spot the problem but the formula is correct. The alpha value i used in my application is used to set the transparency of the barcode that will be embedded in the image. Hence, when alpha = 1 the new pixel value should be the barcode value. ^^The formula isn't wrong, it's just not doing what you think it's doing. Remember that you're working with ints here, not floating point numbers, so they have finite precision. When you case from double to int, fractions are dropped. As morgalr pointed out, your formula is:
    (1-alpha * Image pixel value) + (alpha * barcode pixel value) = new pixel value You didn't show us the code for getOriginalImagePixelValue but I imagine it's:
    original pixel value = (new pixel value - alpha * barcode pixel value) / (1 - alpha)On a piece of paper, take alpha = 0.9, image pixel = 17 and barcode pixel = 100. Calculate out what you should get for new pixel value and then calculate what you should get for original pixel value. You will find they don't match.

  • Revel -optimum image size

    What is the optimum jpg  image size to publish in Revel for subsequent viewing on an ipad air (full size)

    You can load the full sized images to revel in the cloud. The revel app will generate smaller versions for viewing on the ipad. It will not load the full sized image unless you choose to download or edit the photo.
    Pattie

Maybe you are looking for

  • Printing Problems with Adobe Reader 10.0.1

    I need some help on printing with Adobe Reader X: we use Multi Funktional Printer from HP, they have some finishing options like Booklet Printing or stapling. when printing 1 copy of a document it is attached correctly, at 2 copys of a document (stap

  • Receiver determination for a proxy

    I have a sender proxy and I want to configure two receivers for this proxy. But I would like to use a condition. If I now open the condition editor then I do not see the message  in the condition editor. Does anybody has experience with sender proxie

  • Need sql query to find out Joins attached with folders

    Hi, Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders. We dont want to see those from front end(disc admin). Thanks abhishek

  • Installing Adobe on a new computer

    I have adobe writer on my old computer.  I have a new computer.  I have downloaded Adobe Writer on my new computer and entered the serial number and registered the program but I still get the gold circles on printed pages.  What do I do.  Do I need t

  • Challenges with Adobe Forms and VC Layout

    I'm having two small problems that are driving me nuts. In the Visual Composer layout view, all of the UI elements are snapping to an invisible grid and making it very hard to create a "pretty" UI.  I can't establish the vertical spacing that I want