Pixels & Images (2 questions)

Hello!
I have two questions:
1. How to I set the color of a pixel on a JFrame? For instance, if I had a JFrame with a size of 600 x 600 pixels, how could I change the color (and alpha) of pixel 30x30 ?
2. How could I create a valid GIF, or any other image file, that other programs could use, using an array of pixels? Or better yet, is there a way to get an image file using a BufferedImage object?
Thanks for any help I get, in case you haven't figured it out I am making a paint program and I am almost finished with it!

1. How to I set the color of a pixel on a JFrame?
For instance, if I had a JFrame with a size of 600 x
600 pixels, how could I change the color (and alpha)
of pixel 30x30 ?You will probably want to add a component to the frame and then paint an image on the component. You can then set the color of the image.
2. How could I create a valid GIF, or any other image
file, that other programs could use, using an array
of pixels? Or better yet, is there a way to get an
image file using a BufferedImage object?http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageIO.html
Look at the various write methods. I don't know if it supports GIF (there used to be some patent issues), but it should support JPG and PNG.

Similar Messages

  • Graphics2D.scale() producing pixelated images from vectors

    I have a set of JPanels that I am using in my game to display the interface. Each one overrides paintComponent() and draws itself using Java2D. That all works great -- you can zoom in, move around, etc. and it all looks very nice and uses affine transformations.
    I'm trying to produce very high resolution images from this interface (for use on a poster) and using scale() is creating pixelated images rather than nice, high res images of the vector data.
    My code works as follows:
    1.) Create an instance of the interface using some saved game state data.
    2.) Create a Graphics2D object from a BufferedImage object.
    3.) Scale the Graphics2D object so that the interface will fill the entire image (in my test cases, the interface is running at 800x600 normally, and the resulting image is going to be 3200x1600, so a 4x scale).
    4.) Call the interface's paint method on the Graphics2D object. Note that all of the paint methods are using calls to fill... and draw...; nothing is getting rasterized in my code.
    5.) Write out the image object to a file (PNG).
    A sample of the output is here:
    http://i176.photobucket.com/albums/w174/toupsz/ScreenShot2007-04-24_11-45-35_-0500.png
    The white circle in the upper left hand corner is drawn in between steps 4 and 5. It actually looks correct.
    Is there something I'm doing wrong? Is it a deficiency in Java itself? Is there some way to fix it?
    Any help would be most appreciated!
    Thanks!
    -Zach
    Message was edited by:
    aaasdf

    Try setting a few hints on your Graphics2D:
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

  • IPhone 6 Pixelated images on instagram, pinterest and the icons on the app store

    Hi!!! I have an iPhone 6, 64GB capacity. All the iOS updates are the latest ones. I'm getting pixelated images on instagram, pinterest and even the icons on the app store, I have tried to turn it of and off but it doesn't seems to work... any idea??.

    Hi alex_h1!!!
    i'm posting some of the images that are pixelated, I haven't  noticed but that includes safari too... Here are some screenshots! I thought maybe it was the internet speed but the same thing happens even on wi-fi .
    Thanks!!!

  • IPhone 5 pixelated images in various apps problem- occurred within last 2 months and must be a result of apple network driver update

    iPhone 5 pixelated images in various apps problem- occurred within last 2 months and must be a result of apple network driver update
    What's the fix?
    Tried reset, restart, reboot, reopen of apps same problem

    What do you mean by reboot? Do you mean restore? Because if you haven't restored, then that's the next step. You'll need a computer with the latest version of iTunes and a USB connector.
    For Mac:
    http://support.apple.com/kb/PH12124
    For PC:
    http://support.apple.com/kb/PH12324

  • Pixelated images while playing back a video shot on my iPhone4s

    Shot a video of my kid playing soccer and when watching on playback mode on either iphoto or imovie it comes out all pixelated images...

    The size of the hard drive that the OS resides upon is not of concern as long as it has enough space for you operating system, the applications and a swap file.
    The reason you NEED to keep you media files on a second drive is that it is TOO MUCH to ask of one drive to deal with all the system level read/writes AND to also seek, find and play all your audio AND video AND renders AND graphics and who knows what else you've got going.
    to get the best possible playback.
    1. Run Diskwarrior and Disk Utilities to make sure the files/directories are clean.
    2 Disconect the system from any network.
    3. Turn off any screen, power, disk power savers
    4.Make the file self-contained
    5. Have ONLY the external drive that the media resides upon connected through the firewire bus.
    6.Shut down and reboot the machine before you start.
    7. Pray.
    Cheers,
    x

  • Pixelated images in safari, please help.

    Hi everyone,
    Hoping someone can help me with a issue i have with my new macbook pro.
    When browsing the net, safari and firefox show really pixelated images. I thought it might be my internet connection compressing data or something, but i have tried other computers on the same internet connection and the images show perfect...
    So this makes me think its the macbook. I have upgraded snow leopard from 10.6 to 10.6.2 and updated safari, but unfortunately this didnt help my problem. So now i have ended up here, asking you people, coz im out of ideas.
    I will include some screen shots so you can see exactly what i mean.
    Notice the bad quality images and even on google's banner it is pixelated heaps...
    Please help if you can. Its very annoying. Cheers.
    screenshots
    http://i134.photobucket.com/albums/q93/Bonustokin/randon/Screenshot2010-02-13at1 00814PM.png
    http://i134.photobucket.com/albums/q93/Bonustokin/randon/Screenshot2010-02-13at1 00814PM.png

    Yes, I see the big ugly squares. They are what appears whenever extremely heavy JPEG compression is applied to a low-resolution image tht has relatively large areas of similar colors. Something somewhere is applying such compression to the pages, or portions of them, that you are viewing in your browser(s). Your MBP is not doing that: it can't. Either the page images (or parts of them) are being compressed by the website owners or, if every web page is affected, they are being compressed by your ISP in the process of being transmitted to you, as Gordito suggests. That would greatly increase the speed of page loading, but at the expense of image quality. You wouldn't see the image degradation on an iPhone or cell phone — the screen is too small — but on the MBP's high-resolution display it would be much more apparent, IF the MBP were receiving the signal in the same highly compressed form as the phone. If the MBP receives the same web pages through an ISP that doesn't over-compress them, they'll look the way they ought to look. So if you are receiving these web pages through a cellular ISP rather than through a broadband connection, take the MBP to a wifi hotspot and connect through wifi instead. I bet things will look different then.
    Compressing images is something a web browser can't do: a browser just displays the signal that comes to it.

  • Image Printing Question

    Hello,
    Bottom line summary: How do I use the Media and Quality setting to get a good image?
    I have an image printing question for an HP 8600 Office. I am trying to get a decent quality image to print
    on regular paper. I gather that I will not get the quality of a photo printer. I gather I'm supposed to use
    HP glossy paper. Please read on ...
    Images come out grainy (rastery) when embedded from an MSPaint project, and if I use Word. However when I printed just an image from image viewer it came like a photo ... but I can't remember what I did. It definitely is capable of printing better. My cartridges all check out, etc. I did the Print Quality Report ... I sure wish I could get that quality when I print other things.
    I tried messing with different settings from the Print - Preference. The Quality (Best, Normal, Draft) doesn't effect the outcome. I tried going into Print - Preference - Media and it makes a difference. I can't figure out which is the best setting for plain paper ... but it's not plain paper. The image rendering algorithm appears to be different for different Media settings. I also tried setting the Advanced Resolution to Maximum DPI. I haven't been totally methodical about this as I was in a rush.
    I see that the printer is being "smart", perhaps a little too smart. 
    So my question is multipart:
    - Is there documenation on the what the Print - Preference - Media settings do?
    - How do I get it to not use grainy/rastery image method, but use the nicer photo method?
    - Should I print Maximum DPI?
    Thanks,
    - Dave -

    Hi @DaveGold , and welcome to the HP Forums!
    I hope you had a great holiday!
    I see you're looking into photo setup options. I'd like to help!
    First I'd recommend this document on Changing Print Settings in Windows 7.  This document should show all the settings you're looking into.
    Also, another thing to keep in mind, when you select 'best print quality' and 'photo paper'. It will only be as good as the source image.
    Good luck and please let me know the results of your troubleshooting steps. Thank you for posting on the HP Forums!
    Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
    Jamieson
    I work on behalf of HP
    "Remember, I'm pulling for you, we're all in this together!" - Red Green.

  • When I start MacBook Pro13 shows gray Screen and flashing file Image with question mark

    When I start MacBook Pro13 shows gray Screen and flashing file Image with question mark , it's brand new I just receive it from Apple Store .

    Startup Manager to select Startup disk.
    http://support.apple.com/kb/HT1310
    Repair Disk
    Steps 2 through 8
    http://support.apple.com/kb/PH5836

  • Photoshop CS6 (vs 13.0.1) Severely pixelated images

    I have a iMac, running OS X Yosemite 10.0.1.   Almost every time I open any files (RAW or Jpeg) I get  severely pixelated images. I'm going from bridge to ACR to Photoshop or browser to Photoshop. it's intermittent. But extremely often.  I can close the file and open it and sometimes it's just perfectly fine and sometimes it happens again.  Any advice would be great.  I keep all of my images on an external hard drive.  I have 8 GB of RAM. All programs uptp date.
    -trevee.

    Or, more likely, it's just the known video driver bugs in MacOS 10.10.
    Apple is aware of the video driver bugs and working on a solution.
    Until Apple can release a solution, you can disable GPU drawing in Photoshop's preferences and restart the app.
    If you really need the GPU features in Photoshop, you may want to consider downgrading to a more stable version of MacOS.

  • Add image to question

    Is there any way to add image to question? For example, a gui
    button or just a screen shot?

    Hi mruan
    While editing the question slide, click Insert > Image...
    Works for me... Rick

  • I Have a UITableView with 17 row. in last 17Th row i applyed cell.selectionStyle = UITableViewCellSelectionStyleNone;  and in this row i also put UIButton with Image -  my QUESTION IS that i want in 17Th row when user tapped Image on button is hide and wh

    I Have a UITableView with 17 row. in last 17Th row i applyed cell.selectionStyle = UITableViewCellSelectionStyleNone;
    and in this row i also put UIButton with Image …
    my QUESTION IS that i want in 17Th row when user tapped Image on button. then Image is hide and when user again tapped then image is shown …
    so PlZ…help me how can i put logic..
    Thanks FrNdZZzzzz…

    Sign in:
    https://developer.apple.com/devforums/
    If you're not a developer, you need to join first:
    https://developer.apple.com/programs/register/

  • DNGs display as 256x192 pixel images

    I picked up Aperture last night and installed the 1.5 update this morning. I imported a directory of DNG files (originally created using an Olympus E-500), and the files display as 256x192 pixel images. ACR correctly displays them as 3264x2448 pixel images. I flipped through the documentation and forums but didn't see any potential fixes. Aperture insists that the previews are up to date.
    Any suggestions?
    Thanks,
    Andreas
    MacBook Pro 2.0 GHz Mac OS X (10.4) 10.4.8

    Apple's Aperture pages state that "DNG files must be generated by the Adobe DNG Converter, with the "Convert to Linear Image" option turned off, and created from RAW formats that are otherwise already supported by Mac OS X 10.4.3 or later."
    I followed those instructions to the letter in that I created the DNGs from E-500 raw files using Adobe's DNG Converter with that option disabled.
    Perhaps Aperture is grabbing the embedded JPEG preview?
    Cheers,
    Andreas

  • Safari broken image link question mark in a blue box icon

    The url I get the safari broken image link question mark in a blue box icon most often is "apple.com/startpage/". There may be 10 or 12 of them. However, most apple.com pages have at least 1. In fact I am looking at 1 right now. I have emptied the cache. I do not wish to reset Safari because I do not want to reenter all of the passwords to various sites. Is there a simple answer?
    1.8 Ghz Power PC G5   Mac OS X (10.4.3)   Safari 2.0.2

    Hi Rex,
    Who is your ISP and what addresses do you have set in the DNS section of your System Preferences -> Network preferences?
    Have you tried logging into a different user account on your machine to see if that has the same problem? This will help us to know whether your problem is local to your account or system wide. If you don't have another account you can use System Preferences -> Accounts -> [+] to create a test one (and [-] to remove it if needed)
    Also, do you use any third party internet software (Norton, Intego, etc.)?

  • Pixelated images and overprint preview

    I have a few images already inserted in a document which are all in CMYK at 300 dpi. When I zoomed in on them, they appeared just like they did in photoshop, nice and clear.
    Last night, I started having trouble with the images appearing pixelated when I add them in. I couldn't find any differences in my workflow in bringing them in, which is the strange part. They are all 300dpi. When I placed some images last night, they appeared pixelated when I zoomed in. Also if I chose Place and just clicked one time, they would appear huge, more than the size they were intended to be, which makes me worry the document may not be setup right, but I cannot find anywhere to adjust the dpi of the document. I have it set for Print, 6x9 size but I dont see where you would modify the dpi for the print setting.
    I made a flattened psd image which shows up in InDesign's info window as 300 dpi/cmyk but when I add it, it tried to make the image huge. So I used a different method and scaled the image into the area I wanted it and it still looked very pixelated when I zoomed in.
    I looked around and turned on the setting overprint preview and the image cleared up. I am about to be placing a lot of images in this document to finish the book so I am trying to get a better idea of what is going on first and make changes to my document if needed. My question is - If the image doesn't display well when overprint preview is off, do I need to worry if it looks good when its turned on?
    Pic 1, overprint preview on. Pic 2, overprint preview off.

    Yes I understand this. I was just worried because strangely, other images I had placed before I did this one were not behaving in the same way. I had scaled them down, which is the only difference I could find. I was just very concerned thats all. I know it may have been a simple question but I am finishing a huge project and just about to drop a lot of work on prepping the photos for my book, so I wanted to double check the process very carefully to make sure I wasn't about to repeat a mistake somewhere 100x...

  • Image resoltion question

    I have a basic question about image resolution. I have taken
    some pics for a brochure with a digital camera. The pictures are
    2800 x 2100 pix. (6.1 MP), 72 DPI.
    My printer recommends sending TIFF format at 300 DPI. I can
    create a postcard at 300 DPI and add the image, without resampling
    the image.
    Will that print ok, or do I need to find a digital camera
    that will shoot at 300 DPI. I am obviously a novice and I could not
    find an answer to my question in the archives.
    Thanks.

    On Thu, 17 Aug 2006 22:56:42 +0400, bwr
    <[email protected]>
    wrote:
    > I have a basic question about image resolution. I have
    taken some pics
    > for a
    > brochure with a digital camera. The pictures are 2800 x
    2100 pix. (6.1
    > MP), 72
    > DPI.
    As a small addition to what Richard said, I think I'll
    explain in more
    detail while camera ppi (or dpi) is a fake.
    From practical point of view, neither camera nor your eye
    have resolution
    in "inches". Both your eye and your camera have *angular*
    resolution, not
    *linear*. It may be recalculated to linear only when you are
    referring to
    particular viewing distance - that is, from a long distance
    you only
    recongize objects of meter size, and from a hand distance -
    of millimeter
    size; and they may take the same amount of pixels in your
    camera photos.
    As a result, there is no such a thing like "best resolution
    for print" -
    you may print large billboard at much smaller resolution than
    fine art
    catalog, and both will look the same under appropriate
    circumstances - one
    from several meters distance, the other being viewed through
    a looking
    glass. Also, there is no such a thing as "camera resolution"
    (unless we
    put the real ruler in the scene <g>). There may be
    *formal* resolution
    setting the camera puts in the image file, or even more
    likely some formal
    resolution assumption your software makes when it reads the
    file without
    any resolution setting in it (you know, software don't like
    "divide by
    zero" things, so it often makes some non-zero assumptions
    when it can't
    get real figures).
    So forget about resolution of camera files. All you need is
    enough pixels
    to cover the number of inches that you wish, under the print
    resolution
    you want. As Joe said, you are likely to have more than you
    need.
    Ilya Razmanov
    http://photoshop.msk.ru -
    Photoshop plug-in filters

Maybe you are looking for