Why is the size of new image constructed using Bufferd Image class less?

I am trying to compress image losslessly, for start I what I am doing is:
step1. Access pixels of .jpg image and store in array
Step2. Reconstruct the image from same array
What I have found is, that the size of new image constructed is less than the original.
I am pasting the code below
public static void main(String[] args) {
BufferedImage sourceImage = null;
try {
sourceImage = ImageIO.read(new File("Sample.jpg"));
} catch (IOException e) {
int type = sourceImage.getType();
int w = sourceImage.getWidth();
int h = sourceImage.getHeight();
byte[] pixels = null;
if (type == BufferedImage.TYPE_3BYTE_BGR) {
System.out.println("type.3byte.bgr");
pixels = (byte[]) sourceImage.getData().getDataElements(0, 0, w, h, null);
try {
BufferedImage edgesImage = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
edgesImage.getWritableTile(0, 0).setDataElements(0, 0, w, h, pixels);
ImageIO.write(edgesImage, "jpg", new File("result.jpg"));
} catch (IOException e) {
Please could any one explain me why is it so?

I am working on a IEEE paper where in I am supposed to achieve a better compression ratios as compared to current JPEG standards. So if only loading and displaying the image results in size reduction and quality too, how do I go ahead with my algorithmI suggest you:
(a) start with images in an uncompressed format such as TIFF, rather than a format which is already lossy (JPEG)
(b) acquire some basic knowledge about JPEG before you attempt to improve on it, and
(c) learn to quote accurately. Otherwise your paper will be refereed out of existence. I didn't say anything about 'loading and displaying the image resulting in size reduction and quality too'. I said 'loading and storing'; and 'change the contents', not 'size reduction and quality too'.
A JPEG load and store operation does not result in a bitwise identical file. Frankly you should already know that.

Similar Messages

  • How to reduce a PDF file size under Adobe Acrobat Reader DC. The size is now 23MB; I need it to be less than 4MB. thanks

    how to reduce a PDF file size under Adobe Acrobat Reader DC. The size is now 23MB; I need it to be less than 4MB. thanks

    I've found in Pdf's many time when you go to Optimize a PDF and look at the font list there are often up to a 1/2dozen copies of a given font, say Helvetica, then that many Helvetica Bold, or Arial or Ariel Italic
    What I do ie remove from list all but one copy of each different font. often dramatically reduces the size. also something lese is Flattening images will in some cases reduce a file size. I have run into a case where it actually made a PDF Larger.

  • How to get the size of physical memory by using system call ?

    how to get the size of physical memory by using system call ?What system call can be used for me to get the size of physical memor? thanks.

    %vmstat 3
    procs memory page disk faults cpu
    r b w swap free re mf pi po fr de sr s0 -- -- -- in sy cs us sy id
    0 0 0 3025816 994456 4 19 6 0 0 0 0 8 0 0 0 459 253 139 1 1 99
    0 0 0 2864688 777408 0 2 0 0 0 0 0 3 0 0 0 428 134 175 0 1 99
    0 0 0 2864688 777408 0 0 0 0 0 0 0 7 0 0 0 448 112 166 0 0 100
    one interesting observation about vmstat I found out is (mostly on Solaris)
    the first line of information always off chart, so I usually do a few interval to get constant result.
    if you use linux
    just
    cat /proc/meminfo

  • Why is the word count different when I use word count from the tools menu to the number at the bottom of my mac word document

    Why is the word count different when I use word count from the tools menu to the number at the bottom of my mac word document

    This forum is for Apple's defunct office suite 'AppleWorks' - since the word count is not in the places you mention I assume you are talking about Microsoft Word? Though it's just possible someone in this forum might also use Word and know the answer, you would stand a higher chance of getting an answer in Microsoft's own forums. You could also try asking in the forum applicable to your operating system - Lion, Mavericks or whatever - on the reasonably chance of finding someone familiar with Word.

  • How can I decide the size of HANA server when using DMO of SUM ?

    Hi expert,
    I want to execute DB migration from MS SQL to SAP HANA by using DMO of SUM.
    So I have a question.
    How can I decide the size of HANA server when using DMO of SUM ?
    Now I have MS SQL in windows server.
    But in order to use HANA , I have to prepare Linux server.
    I want to know How can I decide the size of this Linux server.
    Can I expect the function of data compression in HANA ?
    Thanks in advance .
    Kazuki.

    Kazuki,
    Please take attetion:
    Your linux box already created = Application server:
    Application Server
    Based on the measurements SAP doesn't expect any changes concerning CPU, memory and network requirements for the ABAP application server. This means that the existing hardware and network infrastructure can still be used. Please check the PAM (www.service.sap.com/pam) for further details.
    SAP HANA Appliance ( porvided by your hardware partner)
    Consider SAP Note recommendation for HANA Main Memory, HANA CPU and HANA Disk Space.
    Regards,
    Edinaldo Junior

  • Why do the rulers (cmd R) disappear after using Print (cmd P) ?

    Why do the rulers (cmd R) disappear after using Print (cmd P) ?

    If you are referring to Pages v5.2.2 on Mavericks, or v5.5.1 on Yosemite — the rulers do not disappear in the Pages document when using the Print (cmd+P) keyboard shortcut. The document horizontal rules are temporarily obscurred by the drop down print dialog sheet.
    I observe no evidence of disappearing rules unless they are forced via the cmd+R keyboard shortcut.

  • Why does the slider disappear every time I use it to move the window (Windows: FF 32.0)?

    Why does the slider disappear every time I use it to move the window (Windows: FF 32.0)? How do I get the slider back?

    Problem solved: I have been using Walnut for Firefox ver. 2.0.28 theme. For some reason this has been causing the problem. Started FF in Safe Mode, and the slider problem disappeared. Then proceeded to re-enable the Walnut theme: the problem reappeared. Disabled Walnut theme and reenabled all my other add-ons (about 6 of them). Still no problem. So, clearly there is a problem with the use of Walnut theme in FF ver. 32, at least on my Windows 7 installation.
    Thanks for all your suggestions and help. Good job, all!

  • How to trigger New page while using ALV with classes/oops?

    Hi All
    I am trying to print a report which has to show the data in two pages.
    I am using ALV with classes/oops.
    Though I am able to print the report but a new page is not coming. Whole of the data is coming in one single page.
    Please tell me as to how to trigger a NEW PAGE while using ALV with classes/oops.
    Please send some code samples also if available.
    Thanks in advance.
    Jerry

    using sort option you can do it. in case of grid/oo alv class ALV you can view that only in print mode/preview mode.
    in case of list you can view that directly.
    sort-fieldname = 'FIELDNAME'.
    sort-group = '*'  "triggers new page
    sort-up = 'X'.
    append sort to it_sort.

  • Unable to view image if the size is more than 3KB using XML Publisher.

    Hello,
    We are printing PO approver signature using xml publisher (rtf) on a pdf.
    If the size of the image is 3KB or less, the image gets printed.
    But, if the size is more than 3KB the image does not get printed.
    Additional Info:
    1. The signature is stored as jpg image in fnd_lobs table.
    2. On following code is mentioned in the rtf
    <fo:instream-foreign-object content-type="image/jpg">
    <xsl:value-of select="IMG_SIGNATURE"/>
    </fo:instream-foreign-object>
    3. We are using the following function that converts BLOB to CLOB.
    CREATE OR REPLACE FUNCTION XX_BLOBTOBASE64
    b IN BLOB
    RETURN CLOB
    IS
    sizeb PLS_INTEGER := 4080 ;
    buffer RAW(4080);
    offset PLS_INTEGER DEFAULT 1;
    RESULT CLOB;
    BEGIN
    -- dbms_lob.createtemporary
    -- lob_loc => RESULT
    -- , cache => FALSE
    -- , dur => dbms_lob.CALL
    -- LOOP
    -- BEGIN
    -- dbms_lob.READ
    -- ( lob_loc => b
    -- , amount => sizeb
    -- , offset => offset
    -- , buffer => buffer
    -- EXCEPTION
    -- WHEN no_data_found
    -- THEN
    -- EXIT;
    -- END;
    -- offset := offset + sizeb;
    -- dbms_lob.append
    -- ( dest_lob => RESULT
    -- , src_lob => to_clob(utl_raw.cast_to_varchar2(utl_encode.base64_encode(buffer)))
    -- END LOOP;
    DBMS_LOB.createtemporary(lob_loc => RESULT, CACHE => FALSE, dur => 0);
    Wf_Mail_Util.EncodeBLOB ( b, RESULT );
    RETURN RESULT;
    END;
    Requesting any of you to let us know if there is any method to resolve this issue.
    Thanks,
    Angelica.

    Hi,
    Are you using Outlook.com to send/receive emails? Based on my research, we can only add an image/ picture in your e-mail signature that’s Web based (picture that is available in existing websites or stored in an online storage). See:
    http://answers.microsoft.com/en-us/outlook_com/forum/osettings-oemailset/add-logo-to-outlookcom-signature/4455facf-0926-42a6-aad7-756de662a865
    Since this forum is for general questions and feedback related to Outlook desktop application, if you are using Outlook.com, I'd recommend you post your question in the Outlook.com forum:
    http://answers.microsoft.com/en-us/outlook_com/forum?tab=Threads
    The reason why we recommend posting appropriately is you will get the most
    qualified pool
    of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Why is the size of my FPGA VI increasing?

    I am using LABview 8.5 FPGA Module.  I noticed that the size ov my FPGA VI file keeps increasing when it shouldn't.  As a test, I added one simple control to my FPGA VI file and saved it.  As expected, the size of the file increased.  I then went in and did nothing more than delete this control I just added, then saved the file.  The size of the file INCREASED again!  Why would it increase when I delete something from the file!?
    Anyone else see this happen?  Is there some Labview option I need to set or un set to stop this??
    Thanks,
    Rick

    Thanks for your interest, Wiebe.
    The history is off as far as I know. I think the slices are the same.  As amatter of fact, one experiment I did was I checked the VI Properties->Memory Usage, added a simple control, saved the VI, deleted the control, saved it, and looked at the Properties->Memory Usage again.  The numbers between the two times I checked the Memory Usage were the same EXCEPT for the "Total VI Size On Disk", which had increased.
    Here's a detailed description of something I did yesterday.  My FPGA VI had grown to a 140Meg.  I know, pretty big.  I do have a lot in it because of what my application demands.  I created a new empty VI and painstakingly copied all the Labview code (eg. front panel items, block diagrams, etc) from the 140Meg VI to this new one.  I saved the new one.  Bottom line hey had the axact same "code".  However, the new VI file size was only 20Meg!
    I'm beginning to believe that the Save command stored previous versions of my Labview code within the VI file, perhaps for purposes of being able to revert to older revisions???  I know I grasping at straws, but this is becoming an issue.  Any NI engineer listening that knows about this.

  • Why is the size of my pdf increasing after I add text fields?

    I have a simple pdf that by itself is 350kb. But when I add 4 text form fields it increases the size to 2.8mb. Why is this and what can I do to decrease the size but keep the fporm fields for users to type into?
    thanks

    George Johnson wrote:
    Even if you specify Helvetica, Acrobat and Reader substitute a private version of Arial anyway, so all you're doing by specifying Arial is needlessly adding space. The problem is you can't go back and the fields to use Helvetica and see the file size reduction you might expect. This is due to what I consider to be a bug that I'm hoping will get fixed. So you have to start with a fresh PDF, but you can copy the old fields to the new if you first change them to Helvetica. Or if you know how to hack the PDF you can salvage it after changing the fields to Helvetica.
    I was JUST about to type this. I went into my revised pdf and changed the form text boxes to Helvetica and it didnt change the file size. However  I re-created the file from scratch and it is now keeping the file size at the original size. Thanks to both of you for the help!

  • Why does the size of my photos reduce to 0mb after editing in iPhoto?

    Please bear with me here.  I am a new Mac user (MacBook Pro, 2008, OSX 10.7.5), as well as not the most technologically competent person in the world, so I might need a little patience and additional questions to help me understand everything! 
    After a recent trip to Europe, I imported photos that I had taken with two different cameras into iPhoto ('09, version 8.1.2).  All the photos that I took with my Canon Rebel t2i DSLR have not had the problem I'm about to describe, in the past or with photos from this trip.  The problem has been only from pictures that I took and uploaded from my husband's Nikon Coolpix L610 point and shoot.  Not sure if this will matter, but the mode I was shooting in was 16M (4608x3456) which appears to be the "best" quality for this camera. 
    As I was going through my photos and editing them (mostly minor edits, cropping, straightening, enhancing, altering the sharpness/exposure/definition/saturation), I noticed the size of my photos decreasing, as described in the information box in the lower left hand corner of the screen.  With at least 30+ pictures of the ones I have tried editing (this isn't counting the hundreds more that I have yet to start editing), the file size dropped to 0MB, some after one edit as simple as straightening, others taking 2 or more minor edits to drop to 0.  The picture is still there in the multiphoto view (in Photos section under Library), but if I try to click on the picture to view it larger, it just shows up as a black screen.   
    For example, one picture I have showed a size of 4608 x 3456 and 7.6 MB.  When I did one edit (enhance photo), the 4608 x 3456 stayed the same, but the 7.6MB changed to 0KB.  For others, it will decrease some with one edit, then drop down to 0 if I do additional edits.  Most of my pictures are in the 4-10MB range in their original form (no edits).  I'm assuming that I was shooting in jpeg mode, since that's what they uploaded as.  (I've read on here of other people shooting in RAW mode and such, but I don't even think this camera has that capability).  I read some other boards with similar questions, but not the exact same problem as I'm facing.  I know that there is "jpeg compression" with jpeg files when editing. 
    So I guess my question is this:  Is there anything I can do to stop this reduction down to 0?  I will only be printing out a few of these pictures, and most in a 4x6 or 5x7 size.  I'm more concerned with being able to post them to Facebook for my family, who lives far away.  When the file size is 0KB, it won't upload because it doesn't even register as there being a picture and if I try it anyway, it gives me an error message, something along the lines of not supporting this format (or something similar, has been a couple days since I last tried). 
    I read something one of the similar boards that mentioned saving the edited photos as TIFF files, but it also mentioned that that takes up a lot more disk space, which I'm not sure if I want to (or have the space to) do.  (Side question:  If I did check the box in Preferences --->Advanced "Save edits as 16-bit TIFF files, would that do that to every picture in my library that I have edited?)
    As I said, I'm new to this whole Mac stuff (been using it for just under a year, given to me by my brother-in-law after my computer died), so please use as much layman lingo as possible!  And thank you in advance for anyone that can give me any insight and/or advice! 

    None of my pictures that I uploaded into iPhoto are in my Finder under Pictures.  Should I copy and paste my folders from iPhoto into here, in case something happens to my iPhoto program (in addition to backing them up onto an external hard drive like I already do)?
    No, that's just wasting space.  A back up needs to be on a different disk.
    Your photos are within the iPhoto Library.

  • HT4759 Why when I got my new computer now using windows 8. I lost all my playlists and my purchased song list. Im missing so much music....I downloaded Itunes onto the new computer, I logged into my account w/ my apple ID expecting all my stuff to be as i

    My issue is just with itunes....not my ipod... Ive been afraid to plug my ipod in to charge it incase it automatically sincs with the Itunes I have now on my new computer since this itunes is empty of my purchased songs and self made playlists. I dont want my ipod erased! I just dont understand why I cant get someone on the phone with their support service with out a serial number?! Itunes does not have a serial number that I can find. I just want my account to be as it was on my old computer. I very much dont want to lose all my music

    From the OP: "My old computer got a virus and when that happened all my music was lost. "
    They don't have the music on their computer so they cannot transfer the iTunes folder, from the computer to their iPod and then to the new computer. And if they try to enable disk use on the iPod it will erase all the music that is on it. The method you cited is moving the files in a data format using the iPod as a flash drive. It doesn't work if they are in music format. That is why I suggested Yamipod.

  • How to change the size of New Page create pop up window ?

    In Site Actions on clicking of New Page the pop up page is opened it is stretched mode.
    I want to change the width of that pop up windows only.
    After pressing F12 key i find that it is happening because of the java script  function on calling of which that page is opened.
    But i am unable to find that javascript function from where it is calling or where it is written or how i can modify that function.
    So please help me out in solving that issue.

    Hi,
    According to your post, my understanding is that you want to change the size of the new page pop up dialog.
    We can create a new dialog with proper size to achieve it.
    I have made a simple code demo to create a new dialog with proper size, you can have a look at it.
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function(){
    ready();
    function ready(){
    $("span[title='Open Menu']").click(function(){
    //alert(2);
    setTimeout(openNewPageClick,500);
    function openNewPageClick(){
    //setTimeout(openNewPage,1000);
    $("#mp1_0_3").removeAttr("onMenuClick");
    $("#mp1_0_3").click(function(){
    url="http://sps/_layouts/createwebpage.aspx";
    openDialogBox(url);
    function openDialogBox(url){
    var options = SP.UI.$create_DialogOptions();
    options.url = url;
    options.height = 900;
    SP.UI.ModalDialog.showModalDialog(options);
    </script>
    Note: You should change the ID or class to fit your environment.
    More reference:
    http://kyleschaeffer.com/sharepoint/sharepoint-2010-pop-up-dialogs/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Why is the size of my pdf file so large

    In the templet,I use a font type "Simsun" for Chinese in the subform.
    This font type is added in the output desginer by "font setup" .
    And this font has been existing in my os.
    When I generate a pdf file, the size reaches >6M.

    George Johnson wrote:
    Even if you specify Helvetica, Acrobat and Reader substitute a private version of Arial anyway, so all you're doing by specifying Arial is needlessly adding space. The problem is you can't go back and the fields to use Helvetica and see the file size reduction you might expect. This is due to what I consider to be a bug that I'm hoping will get fixed. So you have to start with a fresh PDF, but you can copy the old fields to the new if you first change them to Helvetica. Or if you know how to hack the PDF you can salvage it after changing the fields to Helvetica.
    I was JUST about to type this. I went into my revised pdf and changed the form text boxes to Helvetica and it didnt change the file size. However  I re-created the file from scratch and it is now keeping the file size at the original size. Thanks to both of you for the help!

Maybe you are looking for

  • Newbie in creating JNLP have questions

    Ok I have never setup a JNLP application, but I would like to give it a try. I am reading the java documentation "Deploying Software with JNLP and Java Web Start," though I believe that article was from 2002. I was under the impresion that JNLP would

  • Spark Video Player pause / resume loading

    I am developing an application that loads many images and sounds in the background. When a page containing still unloaded content is requested, the current background load is canceled in order to free all of the user's available bandwidth to load the

  • MI 7.0 Questions....

    Hi Experts, I've been doing some research on MI 7.0 and i have some doubts.... 1. Is MI included in Application Server SP12? If true, in Portal how do I access it? 2. I cant find any learning maps for MI 7.0, only for 2.5 and 7.1....are they availabl

  • Text printinng misalign from text include

    Hi Buddy, I am using smartform / smartstyle to print my layout. I was able to print correctly my output but somehow some of the blank character was misaligned. Eg. my orginal text is like this: Article   2342           phone no     2332 Article   299

  • Rendered files for hardware output?

    I'd like to get the best results possible when "playing out" a given Premiere sequence through my Kona LHi. I'm particularly interested in optimizing downconversion (HD-SD) via hardware. If there are differences between "preview" output and "play" ou