Image contrast?

Hi,
I need to change the contrast of an image. Can anybody give sample code. Please it is very urgent..I already posted this one. But nobody responded..
Thanks for ur help,
-balaji

I'll just point you in the right direction.... no full code examples to give you.
http://java.sun.com/products/java-media/jai/
Page 1 says that it can do "simple operations like contrast" etc..

Similar Messages

  • Change image contrast

    Hi,
    I need to change image contrast, that code working for .bmp image only.
    public static BufferedImage rescale(BufferedImage indexed,
                   float scaleFactor, float offset) {
              System.out.println(indexed.getHeight());
              IndexColorModel icm = (IndexColorModel) indexed.getColorModel();
              return new BufferedImage(rescale(icm, scaleFactor, offset), indexed
                        .getRaster(), false, null);
    public static IndexColorModel rescale(IndexColorModel icm,
                   float scaleFactor, float offset) {
              int size = icm.getMapSize();
              byte[] reds = new byte[size], greens = new byte[size], blues = new byte[size], alphas = new byte[size];
              icm.getReds(reds);
              icm.getGreens(greens);
              icm.getBlues(blues);
              icm.getAlphas(alphas);
              rescale(reds, scaleFactor, offset);
              rescale(greens, scaleFactor, offset);
              rescale(blues, scaleFactor, offset);
              return new IndexColorModel(8, size, reds, greens, blues, alphas);
         public static void rescale(byte[] comps, float scaleFactor, float offset) {
              for (int i = 0; i < comps.length; ++i) {
                   int comp = 0xff & comps;
                   int newComp = Math.round(comp * scaleFactor + offset);
                   if (newComp < 0)
                        newComp = 0;
                   else if (newComp > 255)
                        newComp = 255;
                   comps[i] = (byte) newComp;
         }If i am use .jpeg or .jpg image then following error will appearjava.lang.ClassCastException: java.awt.image.ComponentColorModel
         at com.maan.image.DAO.ImageBean.rescale(ImageBean.java:141)
         at com.maan.image.DAO.ImageBean.loadImage(ImageBean.java:39)
         at org.apache.jsp.imgManipulation.alterImage_jsp._jspService(org.apache.jsp.imgManipulation.alterImage_jsp:59)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)any one help me, what i am going to do,
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    My guess is that it's this line:
    IndexColorModel icm = (IndexColorModel) indexed.getColorModel(); The BufferedImage that you are sending to rescale probably uses a ComponentColorModel when you load from a .jpg and an IndexColorModel when you load from a .bmp file. You can't cast between the two. You may be able to do what you're trying to do by using the getRBG method from BufferedImage and forget about the ColorModel.

  • Image contrast and brightness

    Hi i'm a newbie to java. i want to laod a image on swing and want to adjust its brightness and contrast. How can i do this ?

    See
    http://www.jhlabs.com/ip/coloring.html#hsb
    The code for the filters used can be downloaded
    http://www.jhlabs.com/ip/download.html
    I think this should answer your question

  • Exporting slide show from iPhoto to QT raises contrast and darkens images?

    I have been using iPhoto to create slide shows (with transitions) which I then save as QuickTime (.mov) files. I add soundtracks to the QT.mov file in QuickTime Pro and burn the finished slide show to CD's for my friends and coworkers.
    The original photographic image files come from several sources; mostly a digital camera, but often scanned color slides (from the dim, distant past). All of the images have been (painstakingly!) corrected in PhotoShop, and saved as finished size Jpeg files.
    When I import the images into iPhoto, edit and arrange them in a folder and preview the show as a slideshow in iPhoto, the images still look perfect.
    When I save the show by exporting it to QuickTime, all of the images get darkened and the image contrast increased.
    This is making me nuts.
    To quantify the unwanted "enhancement" that iPhoto seems to be applying to my images, I experimented in PhotoShop; I can make the original (correct) image match the "QT enhanced" image by decreasing the "Lightness" slider by -8 to -12, and increasing the "Contrast" slider by +11 (in whatever units PhotoShop sliders are calibrated).
    The resulting change in the images is infuriating: the darkening increases the color saturation and blocks up the shadow details so that many images are unusable.. black skin tones, for example, become a dark red/brown color with an unnatural gradation from light to dark.
    Further experimentation using IDVD and QuickTime slide shows (without transitions) made from sequencial files directly in QT seem to indicate that the problem is not in QuickTime itself, but rather in the transition from iPhoto to QuickTime when I export the finished folder as a slide show.
    It seems like iPhoto is "enhancing" or "tweaking" the images as it exports them to QuickTime: It adds contrast and reduces brightness, both of which might serve to add "snappiness" to a lot of generic snapshots that people shoot, but my images have already been fixed (thank you) and really don't need anyone's generic "tweak"
    Does anyone know what it's doing, and more importantly to me, how do I turn the damned thing off?
    G5 dual 2.3Ghz   Mac OS X (10.4.6)   Terabytes of disc space.

    iPhoto can make two different types of slide show movies. It would help to know which you're making.
    One is made via the File/Export to QuickTime movie and makes a 4 track file with a simple fade effect. These use the Photo-JPEG codec.
    The other is a 30 fps "video" using H.264 video codec via the "Share" menu.
    A third method (rarely used) is to Export to iDVD. This makes an absurdly high data rate MPEG-4 video. This is also found under the Share menu.
    The MPEG-4 video codec also includes an "automatic" gamma correction feature which compensates for the gammas difference between Mac's and PC's.
    Try one export to iDVD. Include your audio track prior but use a high quality (.aiff) sound file. No need to actually "burn" the DVD. You can even close iDVD after it opens. You'll find the new movie in your Users Movie folder.
    Open it with QT Pro and export to a new .mov file. Adjust the data rate to something more reasonable and add some audio compression.
    If the colors still look too dark you can use the built in Filters in the Export dialog. You can adjust B&C or HSL or even use ColorSync Profiles that can help correct the image quality (if needed).

  • Image appears flat when published from Lightroom 4 to Smugmug but not when exported as jpgs, help?

    I have searched the forums and the internet to no avail, I cannot figure out why an image I am publishing directly to smugmug via LR 4 appears flat. My guess is it has to do with the color space since upon export as a JPG the image contrast appears fine. I shoot camera RAW but copy as DNG upon import, I cannot locate color settings aside from the external editing options. Why is this happening? I would love to continue uploading/publishing directly from lightroom to smugmug.
    Here is a link to the flat image uploaded via the smugmug plug in
    http://www.kimstarphoto.com/photos/i-XHWXCTv/1/X2/i-XHWXCTv-X2.jpg
    And here is the published JPG
    http://25.media.tumblr.com/547e9a23a169f83611d0fd0e56526d6b/tumblr_mvibfpkCV21rhkurwo1_128 0.jpg
    Any thoughts or input would be greatly appreciated.
    Thank you!

    No, I'm not sure links works in an interactive PDF (it has SWF-player embedded).
    The default slide quality since 6.1 is now Optimized, I have been pleading for that for reasons like what happened with you. If you use 24-bit graphics (maybe with transparent pixels), or want crisp text, it is logical that you cannot achieve that with 8-bit quality. But not every CP-user is knowledgeable about that kind of graphics stuff.
    Lilybiri

  • How big does an image/project need to be in order to project it onto a screen without it becoming blurry?

    I am creating a project that will be projected onto a large screen, and I want to be sure it doesn't come up blurry. What size/settings are best for a project like this?

    There are so many variables involved:
    Quality of the projector
    Capacity to adjust light level, image contrast and color balance
    Distance from projector the screen
    Degree of magnification
    Distance from audience to screen
    Ambient room light
    ….just to name a few that it would be prudent to run some tests. There is no one-size-fits-all calculation that can be considered adequate.

  • Image editing selection tools in Aperture 2?

    Are there any image editing selection tools in Aperture 2 (Magic Wand, selection box etc.)? If not, you can't make any corrections without effecting the whole picture. I guess that would just send you back to Photoshop or Elements for image editing, and then you might as well stay in the Adobe world.

    This isn't what Aperture is designed for. The features you are asking about are not really photographic in nature - they are image manipulations that go beyond what Aperture is designed to do.
    Think of Aperture more as a catalog that allows photographers to make the vast majority of adjustments they need to make to single images (contrast, exposure, white balance, dust spots, minor clone/patching, etc.). It also provides strong keywording and search capabilities.
    Folks who need to do advanced image manipulations/compositing etc. will have to do it in PhotoShop, but they will lose the "library" functions found in Aperture. Lightroom is the same way - you have to export your pic's to PhotoShop to do serious editing/layers, etc.

  • Adjusting Images in Smart Build

    I have a series of images set in a Smart Build, and I want to adjust all these images (contrast, saturation, etc.). When I open Adjust Image - I can't make any changes to the smart build images. Does Smart Build enable this feature? I could just adjust them all in Photoshop, save the jpgs again, and drop them back in...but I was hoping I wouldn't have to do that.
    Please let me know as soon as you can - I would appreciate it so much!
    Thanks!

    Have a look here. Only workaround I have found is to re-do the build. Send feedback to Apple via the Keynote Menu.

  • Mavericks Preview corrupts image file

    I am running Mavericks on iMac circa 2011.  I can use Preview to open 16 bit tiff image files which are 1 or 2 MB each.  Because the pixel values are small, I use the Auto Level button within the Adjust Color tool to see a decent image.  However, if I then close the file by clicking on the x on the top left corner of the image, the saved image will now have zeros in the entire image.  That is, opening it again will not show anything even with the Adjust Color tool   I checked by opening it with MATLAB and sure enough, everything is zero.  This does not occur if I do not try to adjust the image contrast using the Auto Level tool.   This also does not occur if I hit the 'Reset' button within Adjust Color before closing the file.  Please help!

    The startup drive is failing, or there is some other internal hardware fault.
    Back up all data on the drive immediately if you don't already have a current backup. There are ways to back up a computer that isn't fully functional—ask if you need guidance.
    Make a "Genius" appointment at an Apple Store, or go to another authorized service provider.
    If privacy is a concern, erase the data partition(s) with the option to write zeros* (do this only if you have at least two complete, independent backups, and you know how to restore to an empty drive from any of them.) Don’t erase the recovery partition, if present.
    Keeping your confidential data secure during hardware repair
    Apple also recommends that you deauthorize a device in the iTunes Store before having it serviced.
    *An SSD doesn't need to be zeroed.

  • Flex image editing control

    I am looking for a flex control which allows photo or image
    editing. It should be very light, and I need to embed it in my flex
    app. Anybody knows any good one? Thanks in advance, Sean

    This isn't what Aperture is designed for. The features you are asking about are not really photographic in nature - they are image manipulations that go beyond what Aperture is designed to do.
    Think of Aperture more as a catalog that allows photographers to make the vast majority of adjustments they need to make to single images (contrast, exposure, white balance, dust spots, minor clone/patching, etc.). It also provides strong keywording and search capabilities.
    Folks who need to do advanced image manipulations/compositing etc. will have to do it in PhotoShop, but they will lose the "library" functions found in Aperture. Lightroom is the same way - you have to export your pic's to PhotoShop to do serious editing/layers, etc.

  • How can I resize image in iPhoto?

    Question just like the topic states. Also when editing an image; contrast/brightness etc - how can I make sure that the original stays intact?

    It depends on what you want to do with the photo. If you're resizing for printing just go into the Edit mode and crop using the appropriate Constrain selection. iPhoto will automatically save a copy of the original file so you can Revert to Original any time you'd like. If you want to resize for emailing just click on the Mail button and you'll be given the opportunity to select the size you want to sen with the email. The original is not changed in any way.
    Any edit of a photo, crop, brightness, redeye, etc., will cause iPhoto to save a copy of the original file as I stated above.
    Hope this has been of some help. Good luck.
    OT

  • Adjust Image Problem - Image Changes when Mouse Click is Released.

    I love the fact that images can be adjusted after insertion into a page (Things like brightness, contrast etc). The problem I have which is very frustrating is that while any control on the Adjust Image panel is selected and being edited (click and hold mouse button to move a slider), the images' contrast and brightness change (perhaps as if to indicate selection?). This is inherently a problem since it's these very characteristics you're trying to edit. So you adjust the image to your liking but when you release the mouse button, then image then suddenly changes and is no longer the way you want it. Anyone else seen this problem and have any helpful suggestions?

    I have been trying to replicate your issue using  different format images..but I did not succeed.
    If its not images and types that cause the  problem,  then the inference is that it the application.
    The usual advice... unless you  want to contact tech support and present your problem to them - is to uninstall iBA with Appdelete or similar rather than dragged to the trash, and then do a reinstall.
    This presupposes you saved everything/copies etc,.
    BTW, I seldom use the various sliders, with practice using the LEVELS can be more effective, have you tried  this option?

  • Not able to edit more than one function of new photos

    I recently upgraded my iPhoto to 09 after shifting to Leopard 10.5 on my G5. Today, for the first time after the upgrade, I loaded about 100 photographs and have found that I am unable to edit more than one function at a time on these image. For example, the image contrast can be adjusted, but, following that, no other function or cropping appears to work. The saved image, after selecting "Done", doesn't show any change other than the initial edit. Surprisingly, I am able to perform multiple edits on the images that were already in the Library (8,500!). After looking at this forum's topics and trying some of the suggestions provided for other editing issues, I've tried to edit more than one function in full screen view, library and album modes with no success.
    Any help would be appreciated.
    thanks,
    Message was edited by: Umnak ( showed incorrect OS on original)

    If you go the PS or PSE route this many be of some help:
    Using Photoshop (or Photoshop Elements) as Your Editor of Choice in iPhoto.
    1 - select Photoshop as your editor of choice in iPhoto's General Preference Section's under the "Edit photo:" menu.
    2 - double click on the thumbnail in iPhoto to open it in Photoshop. When you're finished editing click on the Save button. If you immediately get the JPEG Options window make your selection (Baseline standard seems to be the most compatible jpeg format) and click on the OK button. Your done.
    3 - however, if you get the navigation window that indicates that PS wants to save it as a PS formatted file. You'll need to either select JPEG from the menu and save (top image) or click on the desktop in the Navigation window (bottom image) and save it to the desktop for importing as a new photo.
    This method will let iPhoto know that the photo has been editied and will update the thumbnail file to reflect the edit..
    NOTE: With Photoshop Elements 6 the Saving File preferences should be configured: "On First Save: Save Over Current File". Also I suggest the Maximize PSD File Compatabilty be set to Always.
    If you want to use both iPhoto's editing mode and PS without having to go back and forth to the Preference pane, once you've selected PS as your editor of choice, reset the Preferences back to "Open in main window". That will let you either edit in iPhoto (double click on the thumbnail) or in PS (Control-click on the thumbnail and seledt "Edit in external editor" in the Contextual menu). This way you get the best of both worlds
    2 - double click on the thumbnail in iPhoto to open it in Photoshop. When you're finished editing click on the Save button. If you immediately get the JPEG Options window make your selection (Baseline standard seems to be the most compatible jpeg format) and click on the OK button. Your done.
    3 - however, if you get the navigation window that indicates that PS wants to save it as a PS formatted file. You'll need to either select JPEG from the menu and save (top image) or click on the desktop in the Navigation window (bottom image) and save it to the desktop for importing as a new photo.
    This method will let iPhoto know that the photo has been editied and will update the thumbnail file to reflect the edit..

  • Buying a new Monitor

    +*I have a Mac iBook 800 MHz PowerPC G3 with 256 MB SDRAM running Mac OS X Version 10.4.11.+*
    +*The Graphics/Displays says the following:*+
    ATI Mobility Radeon 7500:
    Chipset Model: ATY,RageM7
    Type: Display
    Bus: AGP
    Slot: ATI
    VRAM (Total): 32 MB
    Vendor: ATI (0x1002)
    Device ID: 0x4c57
    Revision ID: 0x0000
    ROM Revision: 113-XXXXX-207
    Displays:
    Color LCD:
    Display Type: LCD
    Resolution: 1024 x 768
    Depth: 32-bit Color
    Built-In: Yes
    Core Image: Not Supported
    Main Display: Yes
    Mirror: Off
    Online: Yes
    Quartz Extreme: Supported
    Display:
    Status: No display connected
    +*The monitor output plug hole on the side of the computer is a mini DVI.*+
    +*I am thinking of buying an external monitor. A 21.5 in Samsung EX2220x which has both DVI-D input and Dsub input. The latter is labeled RGB-in on the back of the monitor. Its specs are:*+
    Display
    Screen Size
    21.5" Wide
    Brightness (Typical)
    250 cd/m²
    Contrast Ratio (Typical)
    MEGA DCR (Typ. 1,000:1)
    Resolution
    1,920 x 1,080
    Response Time (Typical)
    5 ms
    Viewing Angle (Horizontal/Vertical)
    170˚ / 160˚ (CR> 10)
    Color Support
    16.7 M
    Signal input
    Video Signal
    Analog RGB, DVI
    Sync. Signal
    Separate H / V, Composite, SOG
    Connector
    15pin D-SUB, DVI-D
    Power
    Power Consumption
    22 Watts
    Stand By Power (DPMS)
    <0.3 W
    Type
    Built-in
    Features
    Plug & Play
    DDC 2B
    USB powered hub option
    No
    Mac compatibility
    Yes
    Multimedia Speakers
    No
    Wall-Mount
    75 x 75 mm
    TCO
    TCO'5.0
    Cabinet Color
    High Glossy Black
    Optional Accessories
    DVI Cable
    Special Features
    MagicBright3, MagicEco, MagicAngle, MagicReturn, Off timer, Image Size Color Effect, Customized key, Windows7, DVI with HDCP
    +*My question is will my Mac drive this monitor & if so would it be best to connect the computer to the DVI-D or the RGB input?*+
    +*If the Mac will not drive the above monitor will it drive my second choice a 20 in Acer X203HBD which has both a DVI w/HDCP and a VGA input. Its specs are:*+
    TFT Technology
    TN
    Image
    Image brightness
    300 cd/m2
    Image Contrast Ratio
    10000:1 (dynamic)
    Max horizontal view angle
    170
    Max vertical view angle
    160
    Display
    Diagonal Size
    20 in - Widescreen
    Dot Pitch / Pixel Pitch
    0.276 mm
    Max Resolution
    1600 x 900 / 60 Hz
    Color Support
    24-bit (16.7 million colors)
    Max Sync Rate (V x H)
    75 Hz x 80 KHz
    Response Time
    5 ms
    Signal Input
    DVI-D, VGA
    Features
    HDCP
    Video Input
    Analog Video Signal
    RGB
    Digital Video Standard
    Digital Visual Interface (DVI)
    Expansion / Connectivity
    Interfaces
    1 x VGA - 15 pin HD D-Sub (HD-15) , 1 x DVI-D - 24 pin digital DVI
    +*My question is will my Mac drive this monitor & if so would it be best to connect the computer to the DVI or the RGB input?*+
    Thank you for your help.

    If the monitor has a VGA input, as it appears it does, and will support 1024x768, then you could use it, but it would be a waste of a 22" monitor. Without hacking your iBook an external monitor will only mirror the internal screen (the iBooks do not officially support extended desktop mode which allows you to have different things on the two screens) and at 1024x768, far below the monitor's native resolution, things will be quite fuzzy.
    Regards.

  • Sony fix camera software for z1 ,z1s,z1 compact and bring z2 camera stuff

    the camera software makes the exposure and iso to its highest settings most times so it produces bright pictures and the algorithm for low light is really bad fix it sony 

    I do not understand why Sony does not pay more attention to the camera if it is in the foreground put her trump card as being in charge, I found the example application čameringo .... which is much more better than Sonny supplements camera has options for temperature image contrast image and then obtain a realistic view as the very sonijava camera with a bright color that you can not reduce, why Sony does not have in its application to the camera?

Maybe you are looking for