Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default What's in a pixel?

    This has bugged me about Xara for ages and today I worked it out (should have been obvious, some will say).

    I export a lot of bitmaps from Xara, usually selecting some group and then exporting. I usually choose an new bitmap size from the export dialog with the size usually chosen to fit precisely some part of a web page (often to connect with an adjoining graphic).

    I've always been pretty miffed to find that the exported bitmap is often one pixel out in one dimension compared to what I expected - certainly different to that presented in the export dialog.

    Usually one dimension is the most important for me - either I'm wanting a precise horizontal dimension, or a precise vertical one - the trick is always to specify that particular dimension for the bitmap and it'll be right in the export, though the other dimension may differ by 1 pixel in the resulting export.

    This is good enough for me and seems to be related to the scaling factor giving different results between the export dialog and the actual bitmap dimensions. If you tweak the scaling factor to be a whole percentage, not a decimal, then it's always exported as per the dialog.

    Seems to me that really the export dialog size and the actual export size should always agree, but I can live with this.

    The moral of the story? Always choose the bitmap size for export using the dimension that is most important for you, because the other may well differ by one pixel.

    Hope that's not too confusing, even if it is long winded. I've attached a small example. Select the rectangle and export as a gif. Set the width to 75 and the height will show as 65, the resulting bitmap will be 75x64 though. If you set the height to be 65, the width will show as 76 but the resulting bitmap will be 75x65.

    Paul
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2005
    Location
    London, UK
    Posts
    538

    Default Re: What's in a pixel?

    I see what you're saying, but your original shape is 137.7 pixels wide and 118.7 pixels tall in Xara.

    If you wanted exact-sized exports you should create them at the size you need within Xara rather than resize them on export: at 75 pixels wide the same shape is 64.6 pixels wide rather than 65 exactly.

    For complete accuracy you could consider using only whole numbers of pixels for your height/width and snap the objects to whole numbers on the grid co-ordinates as well -your original shape is at 63.1, 379.2 rather than the more rounded, say, 60.0 and 380.0. Keeping things whole at the start helps keep the accuracy towards the end - especially for when you come back in a year's time to edit something and can't remember how/where you resized the original.

  3. #3
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: What's in a pixel?

    I think I've had my wrists slapped! ;-)

    I take your point, but either way the dialog and exported bitmaps should match in size.

    Paul

  4. #4
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,514

    Default Re: What's in a pixel?

    Yes, but when you specify a fractional pixel amount, Xara fudges to round off to the nearest pixel.

    The best way to get your image to an even pixel amount is to turn off Lock Aspect Ratio and adjust the Width and Height independently to the nearest even pixel amount. So if your image is 642.3 pixels wide, make the size 642 pixels. If the amount is greater than point 5, 641.7 for example, round up to 642 pixels.

    Then export.

    Also, if your image has an outline, this can be a problem because even though the image reads correctly in the Height and Width text entry boxes, it might not be correct when you export because Xara spits the width of the line.

    If this is the case, clone the shape. Convert the outline to shapes (Arrange > Convert Line to Shape. Make sure the size of the shape is to exact pixels. Then select the original shape and set the outline to none.

    (We don't slap wrists here, we just try to help. So hand me that ruler and hold out your wrists :-)

    Gary

    Gary

  5. #5
    Join Date
    Dec 2003
    Location
    Lancaster, CA, USA
    Posts
    3,080

    Default Re: What's in a pixel?

    The reason more for the rounding on pixels is that although you can use a web editor, you may not be dealing with HTML code, the web does not accept fractional pixels. If you were writing just code in just a text editor rather than using FrontPage or Dreamweaver or any other HTML editor, even though it may be able to import your image, if it isn't getting whole number of pixels you will end up with that process rounding your data too. In which case you have an accumulation of error, which is perhaps worse.

    There are also errors in rounding pixels in about every program, many complaints on that one. Just find the way that works and live with it until then.

  6. #6
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: What's in a pixel?

    Hi Sally. Yes, I realise that fractional pixels are an absurdity on the web. My main gripe is that Xara is telling me one thing in the export dialog, but doing something else in practice. Strictly speaking, I'd say it's a bug.

    As you say, I'll learn to live with it.

    Paul

  7. #7
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,930

    Default Re: What's in a pixel?

    Paul

    As Gary stated above your main problem is the line width, which gives a different size than the inner shape. Experiment. Select the shape, and it shows the size is 137 x 118 pixels. It also has a 0.5pt outline. Now change the outline to 72pt. The size remains as 137 x 118. Now export this: My export dialogue box gives the bitmap size as 233 x 214 !!!

    The method I use to eradicate this is always to scale the image to the size I want it to appear in the web page first. If you don't want to resize your original, copy and paste to a temp xara page & rescale. 1) I do this because I'm scaling a vector object, which will scale without image loss. 2) I see exactly how the image should appear on screen prior to export. i.e. WYSIWYG.

    Finally, select all the items within the drawing and Group. Now place a rectangle over the image, set it to No fill / No outline. Drop to wireframe. Ensure the rectange is competely outside the group. (Alter the rectangles size if needed using the input boxes thus ensuring whole pixel dimensions) Put the View Quality back to Anti-Aliased. Select All / Export. Don't change any of the settings in the export dialogue box, re size or dpi.

    I find this works 100% of the time and becomes second nature.

    Egg
    Last edited by Egg Bramhill; 28 November 2005 at 02:51 AM.
    Egg

    Minis Forum UM780XTX AMD Ryzen7 7840HS with AMD Radeon 780M Graphics + 32 GB Ram + MSI Optix Mag321 Curv monitor
    + 1Tb SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  8. #8
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: What's in a pixel?

    Thanks Egg.

    I've gotten the message about why the bitmaps as sized as they are and how to get a predictable size. I still say that an export dialog that shows (and allows the user to specify) an export bitmap size which differs in many cases from what it will actually do, is a bug, albeit one that can be lived with.

    Paul

  9. #9
    Join Date
    Nov 2005
    Location
    Detroit, MI
    Posts
    129

    Default Re: What's in a pixel?

    Paul,

    You're absolutely right of course. Workarounds notwithstanding. Xara should do the work of figuring out how it should resolve all those nits while it's showing you the pixel dimensions in the export dialog -- not after you've clicked OK.

    I've encountered the problem as well and it is maddening to have to go back and construct a "proper" bounding box for the image. (And it's certainly horrible workflow to have to break your image up into less-than-editable bits just so that Xara will properly consider the line widths.)

  10. #10
    Join Date
    Dec 2003
    Location
    Lancaster, CA, USA
    Posts
    3,080

    Default Re: What's in a pixel?

    CorelDRAW does something similar, maybe from the years of association, some of the bugs are similar too.

    Keep track of your workaround and it will be good advice for the rest of us.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •