Possible to paint single pixel?

The Graphics class has methods to paint different object eg.:
drawOval(int x, int y, int width, int height)
but is it possible to paint just one pixel?

fillRect() can be used for that.Although it should be noted that drawLine() is faster. Of course, knowing that is only useful if you're drawing lots of single pixels.

Similar Messages

  • JS/PS CS3: identify single pixels sticking out

    In a bitmap, is it possible to identify single pixels sticking out from a shape? Let's say I have this black shape in a black-and-white bitmap:
       xxxxxxxx
       xxxxxxxx
       xxxxxxxx
       xxxxxxxx
            x
    an 8 by 4 rectangle with one pixel sticking out from the bottom. Question is, can I find such pixels using a script (JS) and make it white?
    Thanks,
    Peter

    Peter, I added the work around to the script. It appears to fix the problem. With my basic test files.
    #target photoshop
    app.bringToFront();
    while (app.documents.length) {
      app.activeDocument.close(SaveOptions.PROMPTTOSAVECHANGES);
    var defaultFolder = new Folder ('~/Desktop');
    var inputFolder = defaultFolder.selectDlg('Please select your Folder of Bitmap files…');
    var outputFolder = defaultFolder.selectDlg('Please Make/Select a Folder to save Cleaned up files to…');
    if (inputFolder != null && outputFolder != null) {
    var fileList = inputFolder.getFiles(fileFiltering);
    if (fileList.length > 0) {
    main(fileList);
    } else {
    alert('This Folder contained NO Photoshop Tiff files!');
    } else {
    alert('A Required folder was NOT chosen!!!');
    // Main Photoshop file processing
    function main(fileObjs) {
    with (app) {
    var whiteRef = new SolidColor();
    whiteRef.rgb.red = 255;
    whiteRef.rgb.green = 255;
    whiteRef.rgb.blue = 255;
    backgroundColor = whiteRef; // This will be used with resizeCanvas(+)
    var userDisplayDialogs = displayDialogs;
    var userRulerUnits = preferences.rulerUnits;
    displayDialogs = DialogModes.NO;
    preferences.rulerUnits = Units.PIXELS;
    for (var i = 0; i < fileObjs.length; i++) {
    if (fileList[i] instanceof File) {
    open(fileObjs[i]);
    var docRef = activeDocument;
    with (docRef) {
    var baseName = app.activeDocument.name.slice(0, -4);
    if (mode != DocumentMode.GRAYSCALE) changeMode(ChangeMode.GRAYSCALE);
    docRes = resolution;
    resizeCanvas(width + 4, height + 4, AnchorPosition.MIDDLECENTER);
    // Cleans single pixels
    artLayers[0].applyMaximum(1); // Adjust as required
    artLayers[0].applyMinimum(1); // Ditto
    artLayers[0].invert();
    artLayers[0].applyMaximum(1); // Ditto
    artLayers[0].applyMinimum(1); // Ditto
    artLayers[0].invert();
    resizeCanvas(width - 4, height - 4, AnchorPosition.MIDDLECENTER);
    var thisBitmap = bitmapOptions(docRes)
    changeMode(ChangeMode.BITMAP, thisBitmap);
    var newFilePath = new File(outputFolder + '/' + baseName + '.tif');
            SaveFileasTIFF(newFilePath, false, TIFFEncoding.TIFFLZW, false, false, false);
            close(SaveOptions.DONOTSAVECHANGES);
    displayDialogs = userDisplayDialogs;
    preferences.rulerUnits = userRulerUnits;
    function bitmapOptions(res) {
      bitOptions = new BitmapConversionOptions();
    //bitOptions.angle = 0;
    //bitOptions.frequency = 150;
    bitOptions.method = BitmapConversionType.HALFTHRESHOLD;
    //bitOptions.pattenName = '';
    bitOptions.resolution = res;
    bitOptions.shape = BitmapHalfToneType.SQUARE;
    return bitOptions;
    function SaveFileasTIFF(saveFile, aC, iC, la, sC, tr) {
      tiffSaveOptions = new TiffSaveOptions();
      tiffSaveOptions.alphaChannels = aC;
      tiffSaveOptions.byteOrder = ByteOrder.MACOS;
      tiffSaveOptions.embedColorProfile = true;
      tiffSaveOptions.imageCompression = iC;
      tiffSaveOptions.layers = la;
      tiffSaveOptions.spotColors = sC;
      tiffSaveOptions.transparency = tr;
      activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
    // Mac ONLY filtering (Photoshop Tiff's)
    function fileFiltering(fileObj) {
    if (fileObj.creator == '8BIM' && fileObj.type == 'TIFF') {
    return true;
    } else {
    return false;

  • How to fill or erase a single pixel?

    What tool or tools do I have to use to erase or fill a single pixel at a time?
    Sincere thanks in advance for yourhelp.
    Al

    So many ways; you can use one or a combination of:
    Brush Tool set to 1 pixel and a color that matches the area
    Spot Healing Brush Tool set to around 3 or 4 pixels
    Clone Stamp Tool set to a reasonable size based upon area and a soft edge (a graphics tablet like those from Wacom is a big help here due to being able to set size and opacity; pen pressure determines size and/or opacity as you paint)

  • Is it possible to exclude single contacts from the mute? For example: I want to hear when I recieve an SMS alert even if I mute my iPhone 4.

    Is it possible to exclude single contacts from the mute? For example: I want to hear when I recieve an SMS alert even if I mute my iPhone 4 (I am a fireman).

    No iPhone apps have access to the necessary API's to do so...they're all sandboxed.

  • How to copy and paste a single pixel

    How to copy and paste a single pixel
    I want to copy a single pixel and then paste it in the
    position of
    another pixel in the same image.
    (This is in effect changing the colour of the target pixel,
    isn't it.
    But in my case copying an existing pixel seems simpler than
    selecting a
    colour from the swatch or using the colour picker.)
    What is the most efficient way of doing this?
    I tried to select one pixel with the marquee tool. Then
    copied it with
    control-C, but then how do I select the target pixel and
    paste with
    control-V?
    Thanks for your help.
    Adrian

    Use the Pencil Tool
    alex
    adrian stock wrote:
    > How to copy and paste a single pixel
    >
    > I want to copy a single pixel and then paste it in the
    position of
    > another pixel in the same image.
    >
    > (This is in effect changing the colour of the target
    pixel, isn't it.
    > But in my case copying an existing pixel seems simpler
    than selecting a
    > colour from the swatch or using the colour picker.)
    >
    > What is the most efficient way of doing this?
    >
    > I tried to select one pixel with the marquee tool. Then
    copied it with
    > control-C, but then how do I select the target pixel and
    paste with
    > control-V?
    >
    > Thanks for your help.
    >
    > Adrian
    >

  • Is it possible UPLOAD a single printer from an LDT with a lot of printers?

    is it possible UPLOAD a single printer from an LDT with a lot of printers? by using FNDLOAD
    here we can
    download a specific printer definition, we need to follow the below syntax
    FNDLOAD apps/ 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcppinf.lct
    source_printer_def.ldt FND_PRINTER PRINTER_NAME=[printer name]

    Duplicate post -- migrate  printers, types, styles and drivers from an 11i to R12 instance us

  • Is this possible in a single query?????

    While I don't think this is possible in a single query, I definately don't have the background the experts here have. 
    I have a request to identify all shipments in a period/range of periods that have a payment transaction.  For those shipments, the user wants a list of all payment transactions and the initial accrual entry listed by period for potentially a large range of periods.  The accrual and payment entries are identifed by the same characteristic and a 0Amount key figure contains the values.  A couple methods I have tried I have listed in previous threads with either errors or the query blowing up with what appears to be a cartesian product issue.
    Anyone done something like this who can provide pointers.
    Bill

    Hi Bill,
    Why dont u use RRI-report to report interface for this Requierment ??
    There are lots of threads on RRI ,just follow them and u can satisfy this requirement.
    1)Query A for Shipments
    2)Query B for Payment Transactions.
    Call report B from Report A
    1)GOTO RSBBS
    2)Create New
    3)Sender Query Give the First Query Report A
    4)Below sender Query there is Receiver Query  give the RRI query report B (The query which u want to call).Report type should be BEX ,and Target system--Assign the System(Local) and in the report give the Report B.
    5)In the Report A check whether in the GOTO -u get the Receiver Query ,i.e Report B.
    Hope this help !!!!!!!!!
    Rgds
    SVU123

  • Any possiblity to use single Inbound Service Interface with multiple Receiver Agreements

    Hi All,
    Scenario: PROXY to FILE.
    Requirement is to receive to two locations.
    Is it possible to use single Inbound interface with multiple Receiver Agreements. I tried using two operation in the Inbound Service Interface, and Operation Specific in Determination. But couldnt proceed further. Do I need to use seperate Service Interface for two receiver locations?
    Please suggest some solution.

    Hi Naveen,
    There is a possibility but in the case in the same server location with dynamic configuration: Placing file in two different directories using single receiver communication Channel
    With different location you would need to develop a new adapter module as Amit Srivastava explains and develops here Send File to Two Different Locations using Adapter Module
    Regards.

  • I have a single Pixel that is broke on my 2 month old retina macbook pro. I have Apple care. What will Happen if I bring it to an apple store.

    I have a single Pixel that is broke on my 2 month old retina macbook pro. I have Apple care. What will Happen if I bring it to an apple store.

    You can try to see if they will replace it, however there is some sort of acceptable amount of stuck pixels and they won't replace so I hear.
    But that was a long time ago and things change.

  • Is it possible to show single dimension of measure value in Chart

    Hi all,
                  By using BICS connection(BW-Bex Query), developed Application(dashboard) through sap design Studio 1.2 sp01. My requirement is Measure is Purchase OrderValue, and dimensions are x,y,z, and P. When Open application it has to show X-of Purchase Order values in one Chart,Y-of Purchase Order Value in another chart..like we need to show X,Y,Z and P values in different chart. How we can achieve by using single data source.
    Thanks
    Ram

    Hi Tammy,
              Thanks for your quick reply. You are right.. we can create multiple views to show separately. but due to performance issue..is it possible to use single view to finish my requirement?
    Explanation: i have 4 charts
    1 chart: In X-Axis need's to show X-Values and in Y-Axis need's to show PO value
    2 chart: In X-Axis need's to show Y-Values and in Y-Axis need's to show PO value
    3 chart: In X-Axis need's to show Z-Values and in Y-Axis need's to show PO value
    4 chart: In X-Axis need's to show P-Values and in Y-Axis need's to show PO value
                here X,Y,Z,P  are dimensions(fields).
                    unable to add image..
    Thanks
    Ram

  • Cropping problem: crops to a single pixel

    I select part of the image using the crop tool, but when I execute the crop, the result is a single pixel, regardless of the size of the cropping box

    reset the values in the options bar. You will find they are set to 1. CS3 has a mysterious tendency to do this on its own.

  • How to add Event to every single pixel with BitmapData?

    What I want to accomplish: when I drag the cursor over a sprite I want the sprite to break down and every single pixel moves through the screen at random x and y axis.
    To make it simple the draw this is what I want but with much more fragments(pixels) around, thousands of them. How come could I approach this?
    Thanks in advance.

    if mc is the object whose pixels you want to randomize and display in a bitmap:
    var bmpd:BitmapData = new BitmapData(mc.width,mc.height);
    bmpd.draw(mc);
    var bmp:Bitmap = new Bitmap(bmpd);
    addChild(bmp);
    mc.visible=false;
    mc.addEventListener(MouseEvent.MOUSE_OVER,randomizeF);
    function randomizeF():void{
        var a:Array = [];
        for(var x:int=1;x<=bmpd.width;x++){
            for(var y:int=1;y<=bmpd.height;y++){
                a.push(bmpd.getPixel32(x,y));
        shuffle(a);
        var i:int=0;
        for(x=1;x<=bmpd.width;x++){
            for(y=1;y<=bmpd.height;y++){
                bmpd.setPixel32(x,y,a[i]);
                i++;
    function shuffle(a:Array) {
        var p:int;
        var t:*;
        var ivar:int;
        for (ivar = a.length-1; ivar>=0; ivar--) {
            p=Math.floor((ivar+1)*Math.random());
            t = a[ivar];
            a[ivar] = a[p];
            a[p] = t;

  • Just a single pixel.

    I can't find a method in graphics or ghraphics2d that will allow me to change a single pixel in the paintComponent method. the best I can do is a very short line (g.drawLine(x, y, x, y)). surely a method like this would call a method that draws a dot, but I can't find it. a little help please.

    This is just my 2 cents.
    somebody must know more about the 'graphics' class,
    and how the drawLine method is programmed - it must,
    itself, draw one pixel at a time.Well, maybe not. A Java implementation does not talk to the hardware. It will generally have to call some native method that calls a 3rd party graphics implementation (X, WinG, Direct Draw, etc. ), which in turn could call another level of abstraction... including the driver and eventually hardware. There's no guarantee that a 3rd pary API or interface will have a "drawPoint(x,y)" method on ever conceivable OS and graphics configuration. Furthermore it might be the case that a particular optimization occurs in the hardware level. Maybe some graphics hardware is only capable of drawing "lines" even if they are only 1 pixel long. Certainly hardware accellerated 2d and 3d graphics aren't drawn 1 pixel at a time at the software level. It makes sense that a filled rectangle should be done at hardware level, probably evel lines.
    Probably the most overhead here is putting 2 extra values on the call stack.
    Anyway, I think the old saying about premature optimization is as true here as it is otherwise. If you can actually show with the use of a profiler that an application's bottleneck is the Graphics.drawLine method, and that there's no more efficient way to write the app, THEN we have a problem.
    Or satisfy your curiosity:
    public static void main(String[] args)
            int trials = 30;
            int loops = 20000000;
            long cummulative_2parms = 0;
            long cummulative_4parms = 0;
            for (int i=0; i<trials; i++)
                long t;
                //2 parms
                t = -System.currentTimeMillis();
                for (int j=0; j<loops; j++)
                    two_parms(j, j);
                t+= System.currentTimeMillis();
                cummulative_2parms +=t;
                System.out.println(
                        "2 parm ms:  " + t + "\n" +
                        "cummulative " + cummulative_2parms + "\n");
                //4 parms
                t = -System.currentTimeMillis();
                for (int j=0; j<loops; j++)
                    four_parms(j, j, j, j);
                t+= System.currentTimeMillis();
                cummulative_4parms +=t;
                System.out.println(
                        "4 parm ms:  " + t + "\n" +
                        "cummulative " + cummulative_4parms + "\n");
        static void two_parms(int x, int y)
        static void four_parms(int i01, int i02, int i03, int i04)
        }

  • Single pixel vertical line

    Suddenly there's a single pixel white vertical line smack down the center of my screen, always there no matter how I boot up the computer. Any suggestions?

    Any suggestions?
    Take it in for repair.

  • Make a single pixel vertical column

    I have a 1024x768 canvas and I want to draw two 1 pixel columns, one starting in column 0 and one in column 1023 (basically two tall white strips on the far left and far right)
    how can I make this as a png which is transparent in the middle.  I need to put this on top of another image and cover the left and right edges.
    Is this possible with photoshop?

    New Document: 1024 x768
    New Layer
    Click and hold on the Rectangular Marquee. Choose the Single Column Marquee Tool (vertical)
    Click and hold anywhere in the document - drag cursor to upper left (even beyond) Let go of mouse.
    Hold shift key down and repeat on right side.
    Pres the D key to reset swatches.
    Command Delete / Control Backspace (PC)
    Hide background layer.
    Save for Web and Devices - Choose PNG 24. Save.
    Here: Right click and save this file.

Maybe you are looking for

  • Allow me to dismiss / kill "Signature requires validating" banner

    With monitors more squat than ever, why is Acrobat 9 using bigger icons and banners at the top?  Pretty soon there will be no space for the actual document. Well, here's one thing to fix.  When I open a document with a questionable digital signature,

  • JSP with Access Database

    Could I use Access Database in JSP source code without Having DSN (DSN-less) I mean i do not want to set up a DSN in Control panel. I want only give JSP code a access database (.mdb) Please tell me the Connection String. Thank you

  • How to create surrogate key in dimension without unique value

    Hi, I have a dimension where there is no column with unique value. I want to add a surrogate key to replace the existing primary key which is derived from concatenating 3 columns(e.g. 'A'||'B'||'C'). I'm thinking of using sequence. But this won't all

  • IS-U view on equipments transfered by IDOC (ALE)

    Hi all I'm using an ALE to transfer equipments when they are create by transaction IQ04(mass create). Its almost everything working fine. The problem is when the equipments created by IQ04 comes to the receiver client(mandt) they dont have the IS-U v

  • Podcast cover looks fine in app, won't update in store?

    Hi all, I have been lurking on this forum for a while, and I'm sorry to say I have yet another podcast cover issue to throw on the pile! Background: I created a podcast last summer. At first, the cover image I submitted was a bit of a placeholder. A