How to prevent images being compressed inside Jar?

Hi There. I'm creating an applet that uses a Jar file. The Jar file contains three packages. A problem I'm having is when I create the jar using the switches -cvf all the files including some images that are used are compressed, then when the images are used in my application they are corrupted.
I can switch off the compression entirely using the -0 switch, this fixes the problem but makes my Jar file 1.5 MB instead of 300KB! Is there any way when creating the Jar file to prevent it from compressing the images?
Thanks.

If you are using ImageIO, you should (for now) wrap the stream into a new BufferedInputStream.
BufferedImage i = ImageIO.read(new BufferedInputStream(getClass().getResourceAsStream(path)));That does the trick ;)

Similar Messages

  • How to edit a text file inside jar

    Hi all;
    I have a code that created text file and put this file to other jar archive.
    How can I edit this text file inside jar, add string to this file ?
    Thanks,

    Unpack the jar, edit the file, repack the jar.

  • How to prevent images from loading?

    I am working on creating a web gallery in Dreamweaver CS3.  The thumbnails are in a horizontal strip within a layer above the full sized image layer, in other words the strip is  hiding part of the image, but only when the image is in a vertical orientation. (the strip has no background, so all that is visible are the actual thumbnails) Upon clicking show/hide text , in a toggle configuration, the strip fades, or shows.   On my computer it works perfectly. However, once uploaded, it takes forever to load the images.
    The problem: Although I have the thumbnail images are set to preload,  all of the full size images are loading as well, which takes alot of time. Is there a way to prevent the full sized images from loading, i.e. only when the thumbnail is clicked?
    Frames, in which one frame is thumbnails, and another the is images, is what I normally would use, and have a page for each image. However, for what I have in mind, it will not work (transparency on parts of one frame above another is as far as I can tell not possible).
    So how do I prevent images from loading until called for?  regards~bill-o

    t would help if you posted a link to the page, but I can guess that you have properly diagnosed the cause - the page is encumbered with the weight of all of the full-sized images.
    The only way to not have this happen would be to dynamically write the link to the full sized-images on demand, as it were.  In other words, the link ISN'T EVEN ON THE PAGE until you have clicked on the corresponding thumbnail, and only at that point is the weight of that image experienced.  One easy way to do this is to use the SetText of Container behavior that is part of DW's native arsenal of behaviors.  When the thumb is clicked, the SetText behavior is called to write the image link into the enlarged image's container. Need to see a demo?  Look here -
    http://dreamweaverresources.com/tutorials/settextoflayer.htm
    The behavior is called "Set Text of Container", and using it will meet all of your requirements.
    To use it, you will have to have the following:
    1.  A page with a 'container' which is to receive the enlarged image - this could be a table cell, a paragraph tag, a div, or even a span tag.
    2.  That container will have to be identified with an ID attribute and a valid value, e.g., <div id="enlargedImage">.
    3.  A dummy page containing each enlarged image, placed sequentially on the page.
    To implement the effect, do the following:
    1.  Open the dummy page in Code view, and select the first image's tag, e.g., <img src="images/foo.jpg" width="123" height="256" alt="whatever" /> (XHTML syntax shown here).
    2.  Switch to the actual page, select a thumb that will 'open' this enlarged image, and enter "javascript:;" (that's colon semicolon) in the 'Link' field of the Property inspector to make this thumbnail image a null link.
    3.  Apply the Set Text of Container behavior.
    4.  Paste the clipboard into the dialog for the behavior, and click OK to close the dialog.
    5.  Examine the Behavior panel to see which mouse event has been defaulted - probably 'onclick'.  If you would rather have this be 'onmouseover' use the Behavior panel Event selector (the dark triangle to the right of the event name) to select 'onmouseover'.
    5.  Repeat from #1 above until all thumbs have been treated.
    Let us know if this does not make sense

  • How to prevent image compression in Image tags

    I have an image that I want to put ontop of a panel who has a solid background color. The background color in the image matches the backround color of the panel. However due to what I believe is compression, the image's color is checkered and doesn't match. I saw somewhere about controlling this compression in cs3 but I didn't see the global setting, or preferably a per image setting in flex for this. Any ideas?

    "image compression" generally refers to efficient ways of storing image data, not its display.  I think you are describing artifacts from scaling images.  If the image is not of the same resolution as you wish to display it there are various algorithms for reducing or expanding the resolution of an image.  In most algorithms, if the image background is truly a solid color, it would be rare to see artifacts, but if there are slight variations in the color because it is a photograph or scanned image then artifacts are more likely.
    There are various filters and blend modes you can try.  Note that, unless you have other intentions for the image, you've spent extra bandwidth download pixels you'll never need and extra CPU cycles trying to filter and blend them.  Products like Scene7 can help you download just the pixels you need.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • HELP! Audio Podcast Marker Image Being Compressed to Mangled Blob

    I am trying to create an audio podcast in STP2.
    I add an image for the Marker by selecting "Image Source Other" and select a 2444x1583 jpeg image. The image shows up in the preview box and it looks good. I activate Show External Video (^V) and the image looks perfect.
    However as soon as I select any tab, track, whatever... and the image preview box disappears, and I then come back to the marker image preview, the image has now been processed and compressed to a completely unrecognizable blob! If I go ahead and export the podcast, the marker image is displayed in iTunes looking exactly like the mangled image in STP and has been reduce to 53Wx35H pixels!!!
    This mangling also occurs with the Episode image, although it actually does not even get exported to the final podcast.
    To create the podcast I make sure the file type is AAC/Podcast File > Podcast > Enhanced (Images).
    Can someone PLEASE help me figure why the images are being mangled and how I can get a full quality marker image displayed?
    BTW - I have tried various file formats including PDF and PNG and the results are the same - ALWAYS a 53Wx35H pixel image.
    Any help or suggestions would be greatly appreciated!!
    ASIDE - I created the same podcast in Garageband 09 and the images are Crystal clear. However, the marker image ALWAYS gets distorted form wide screen format to square, so that it become useless for distribution.
    TIA for anyone that reads this and responds.

    OK - Got It Figured Out!!! Woo Hoo!!
    I am able to do exactly what I want in Compressor... go figure!!
    1. Select "AAC for Audio Podcast" preset.
    2. In the Encoder Audio tab, select "Enhanced Padcast (m4a file)"
    3. Change "Fit marker images within" to "1280" by "1024"
    4. Add Chapter marker and edit
    5. Change Type to "Podcast"
    6. Select Image "From file" and select the HR file - could drag from Finder as well.
    7. Save
    8. Submit (took about 30 seconds to run)
    Viola!! A nice, tight, small, HR slide show; 5 minutes long and ONLY 4.5 MB - about .1 MB larger than the audio alone! The entire process (once the new preset is saved) takes less than a minute - as long as you know the time code for the marker image placement.
    Took a weekend to figure out, but well worth it!
    Off to make the Client VERY happy!!

  • Images being compressed or resized before printing ??

    I have a 50MB PNG image that I just printed using the built in Kodak printing system. When the image was actually being uploaded, though, it was only 3.2MB in size. What happened to the photo? Did it get converted to a JPEG or PDF? Was it resized? What settings are applied to the image before the upload?
    The image came from a scan of a film negative, and I purposely increased the image size in Photoshop and saved in a lossless format so that it could be printed as high quality as possible. The photo was originally 6000x9000 in size, corresponding to a 300dpi printing. I'm a bit worried that the "compressed/ resized/ whatever was done to it" photo that actually got uploaded will have more visible artifacts...

    If you edit an image with Photoshop from within iPhoto it can either save as a jpg or a psd depending on what edits were performed. Some simple edits with photoshop will keep the jpg extension and that will become the modified version in iPhoto. However if the edits are extensive or layers are created then you either do a Save As to the Desktop an import as a new file or flatten the image and force save as a jpg.
    As far as the 500 MB image getting reduced for uploading I believe iPhoto may do what it does for books and calendars - convert very large files to PDF files. That would account for the much smaller sized uploaded file.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've written an Automator workflow application (requires Tiger), iPhoto dB file backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • How to protect the class files inside jar file.

    Hi Group,
    pls help me.
    my need is i created a executable jar file with certain classes.
    and i'm supposed to send it to my client.
    but if the client needs he can extract the class files from the jar and with the
    help of some decompilers he can convert class file to .java source code and read the whole
    stuff.
    how can i protect my jar file from these.
    is there any security mechanism for that
    pls help me.
    Regards,
    Ranjith.M

    In order to protect my jar file I tried the jar signer technology but it only protects the jar from modification so I need to know how to protect jar file from decoding of the contents inside.

  • How to save image which is inside an applet?

    In my web application, I am displaying some graphs using applet. I wish to let the user save the graphs as images from the browser.
    I would really appreciate if somebody could inform me about this.
    Thanks
    Sachin

    A couple of things...
    1) You will need to sign your applet afterwards, otherwise the user will not be able to save the graphic to their hard drive due to the Java security policy.
    2) I did something similar, a code snippet is below. Mine was a Servlet version though, and sent the buffered stream to a JSP page where it was displayed as a graphic. You can figure out how to modify this so that it goes to a File stream instead... You will
    OutputStream stream;
    BufferedImage bi = new BufferedImage(pieValueObject.getCanvasWidth(),                          pieValueObject.getCanvasHeight(),
    BufferedImage.TYPE_BYTE_INDEXED);
    Graphics2D graphics = (Graphics2D)bi.createGraphics();
    // paint all your stuff on the graphics object created above
    // use a JPEG encoder to actually take what is on the graphics
    // object inside the BufferedImage, and encode it to the stream.
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(stream);
    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
    param.setQuality(1.0f, false);
    encoder.setJPEGEncodeParam(param);
    encoder.encode(bi);
    // Your graphic is now in the Output stream.

  • How to prevent layers being removed

    Hello,
    How can I stop layers being removed from an illustrator drawing?
    for example i have a drawing, i want to share it with a collegue so they can edit it in illustrator but prevent my signature from being removed?
    any ideas?
    Thanks

    With inexperienced users you couldtry and  bury it deep down in a hierarchy of clipping masks and/or layers and lock it there. Works better if it is connected with parts of the actual graphic somehow, so that hiding ot deleting one of those masks will hide or delete everything.
    To my mind it would be better for your relationship to just trust them. At least you work for them - they must be trustable somehow.

  • How to include images/icons for a jar file

    Hi,
    I need to create a jar file which will contain my application. My source code (.java) files are in "app" folder. I compiled that using javac -d . *.java and one package("appl") was created. I have all icons and images related to my application are in the folder named "icons" in the directory where source files are located i.e; app folder - "app/icons". I am accessing the images in the icons directory as "icons/book.gif".
    I created a jar file from source file directory with the option
    jar cvf app.jar app
    and i added this jar file to my classpath also.
    I have created a batch file to execute this application and set that batch file to "path" environment variable.
    It is running from any directory but no icons are appearing in that application if i try to run the application out side the "app" folder.
    Can any body give suggessions to solve this problem?

    Thanks for the added info, now let's get started.
    To use files in jars, you need to refer to them via a URL, so you'll need to modify your code a little bit first.
    URL imgURL = ClassLoader.getSystemResource("icons/BOOK.gif");
    setIconImage(Toolkit.getDefaultToolkit().getImage(imgURL));Next, you'll need a manifest. Using any text editor such as notepad, create a file called manifest.txt and put two lines in it. The first line will specify the class (w/o .class on the end) that contains your public static void main method, the second line is just an empty line (just press return).
    Main-Class: main
    (a blank line)
    Save this file with your class files (e.g. in Exam folder).
    Next build your jar. We want the jar to contain the package folder and your icon folder as well. So use this:
    jar cmf Exam/manifest.txt myJar.jar Exam/*.class icons
    And you should now have an executable jar. You can run it from dos with:
    java -jar myJar.jar
    or you can double-click it from windows.
    -Ron

  • How to prevent folder being copied

    Hi
    Anyone have any idea how to lock a folder and it's contents, basically so it cannot be copied, moved off the hard drive onto any external disk or drive or added as an email attachment, without password authorisation.
    Will be on 10.5.8, and also possibly 10.6.4
    Thanks.

    An encrypted dmg
    how to create a disk image would be your best bet, IMO.
    -mj

  • Airport how to prevent from being cut off by Netcut

    Im using an aiport router connected to my pc, my brother on the other hand is using a program called NetCut which disconnects me from the internet when he feels that i am lagging him. It makes the status connected but no internet connection, is there a way i can prevent this from happening?
    is there a way to protect myself from this? also how can i disconnect people off my network wireless and ethernet?

    you could place a frame with horizontal elasticity set to shrink around your author's field. make that field fill 90% of the page width and place the date-column beside it.
    If you have small number of authors the field should shrink and take the date fied with it.
    If you have a very large number of authors the list would occupy 90% of the pagewidth, spread over more than one row, the dat field would be places at the right end of the page at the top.
    hope this helps.

  • How to prevent images from loading with google search results?

    Since I updated to FireFox 18 I have been getting images (miniature webpages) with my search results with Google. I thought it was a google problem but I don't have the problem in IE.
    Please advise.

    I think you are using some addons, try in safemode...
    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • How to prevent dust fr, How to prevent dust from getting inside the ports and earpiece?

    So I just got my iPhone 5 a coupe days ago and I just can't seem to keep dust from getting inside my phones port and speaker holes and also the earpiece. I have a case on the phone but obviously it doesn't protect those areas. I also bought a can of canned air but that only works when I used it at that moment but as soon as I'm out the house dust starts getting in those areas. I also had this problem with my precious iPhone 4. Can someone help??

    The only thing you can really do is get a case that protects the ports. Lifeproof, Otterbox (to a lesser degree) and Ballistic come to mind.
    I carried a 4 and a 4S for quite some time with no case at all with few problems as a result of dust. Every once in a while, I would get a dust bunny in the headphone jack. Had to clean that out with a toothpick. Clean the dock connector with a clean dry toothbrush.
    I have an Otterbox defender on my 5. Haven't had it long enough to swear to how well it will do as far as dust goes, but so far, so good. The re-designed speaker/mic grille should help some.

  • How to prevent workflow being executed at TEST instance

    Hi,
    We have a problem where wrokflow are not instance - depended.
    I want to have a rule that will be true only if user is at PRODUCTION instance, and will NOT work if user is at TEST instance.
    Any idea?
    Thanks
    Guy

    Hi Guy,
    You didn't mention what the trigger was, but if it includes new records created, I have a solution for you.
    The record IDs all start with 4 letters, usually 'A' and then the three pod designating letters, (ABJA, ABSA, etc.). In all my customers cases staging and production are on 2 different pods, so what you can do is add a condition to the WF rule saying that the record ID must be LIKE 'ABJA*' (use the 4 letters from production) and it will always trigger in prod, while never triggering in staging.
    Again, this will only work for new records created in staging, but that may be enough for you.
    Josh

Maybe you are looking for

  • Upgraded to Lion and now can't drag files around

    I can't drag and drop files/folders nor even move anything on my desktop.... I have to say the "upgrade" to Lion has been the most frustrating ever.

  • Oracle Certification

    Guys.      I am planning oracle certified associate in PL/SQL Developer for oracle 11g. Then i went into the following link http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=39 Then selected Application Developer -> Database -

  • Comparing file content

    Good morning, I am trying to determine if records in one text file are a subset of records in a second file. For example the 1st file(A) contains the names jan eva john And the second(B) contains eva richard jan paul I've started by formulating the p

  • How do you change the home sharing id that is already in place?

    I have an id I want to change for home sharing to match my fiancé's so our libraries match. How do I go about switching out the ids so I can do that?

  • HT4623 iphone cannot be restored an unknown error occurred

    iphone cannot be restored an unknown error occurred