Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Apr 2010
    Posts
    9

    Default Feature Request: Optionally ignore or show only alpha in Picture Compare

    I've just upgraded to the BC4 beta and am really happy with the changes there across the board. I have one issue in my workflow that the picture compare tool in all of the Beyond Compare products doesn't quite work for, and it would be really sweet if a tweak were possible.

    I find myself frequently needing to diff large collections of PNG images that include an alpha channel. These images are obtained from framebuffer dumps and don't necessarily have the property that the alpha channel should be interpreted as opacity. BC4 currently displays images without full alpha (0xFF) as a blend between the RGB pixels in the image and a checkerboard image. This behavior means that the images displayed in the picture comparison tool don't look anything like you'd see on-screen. I can understand why people would want the current behavior, but it would be nice to have additional options here.

    The controls I find useful in this area in other purpose-built tools I sometimes use are:

    (1) A control to disable or ignore transparency entirely. This is the default in BC2. I think this is what BC4 would produce if the alpha channel were 0xFF in all pixels.

    (2) A control to display the alpha channel as grayscale, which would let you see differences in the otherwise invisible alpha channel.

    I currently use BC2 to manage these image collections, because the transparency in BC3/BC4 makes images possible to compare. However, BC2 lacks other useful features (like peeking at individual pixels - a great addition to BC4), and sometimes I have to switch to a different picture comparison tool to compare images and then switch back to BC2 to update my collection. It would be great if I could do everything I need in BC4, and the current version seems pretty close.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,908

    Default

    Thanks for the suggestion. It's on our wishlist to expand our alpha channel comparison and options, and I'll add these notes. Do you have a pair of sample files you'd like to include with how you'd like to compare them (2)? I can add the examples to our wishlist entry as well. You can email them to support@scootersoftware.com, with a link back to this forum thread for our reference.
    Aaron P Scooter Software

  3. #3
    Join Date
    Apr 2010
    Posts
    9

    Default

    Aaron, thanks for the quick response. I've passed along sample images to the Scooter Software support email address you provided.

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,525

    Default

    What kind of data is usually stored in the alpha channel for the images you're comparing? The samples you provided look correct either with or without the alpha blending. Is it random garbage, depth values, normals, etc?

    We have discussed/planned for more control over the different channels, but it definitely won't make it into the initial v4 release and we have some other projects that will take time after that. Short term you should consider using something like ImageMagick to strip out the alpha channels automatically. The picture compare supports external conversion file formats, so you can set up a "PNG no alpha" format that does the conversion and just select it when you need it.
    ZoŽ P Scooter Software

  5. #5
    Join Date
    Apr 2010
    Posts
    9

    Default

    A little bit more about my use case. I work on 3D graphics hardware/drivers, and have a set of tests that work like:

    - create a window with an RGBA framebuffer
    - run a 3D program doing whatever it wants to that RGBA framebuffer
    - read back the RGBA channels of the framebuffer as-is
    - see if the RGBA image matches a previously reviewed images

    In this environment, the RGB contents of the window are displayed on-screen, and the alpha is typically irrelevant from the user's POV. We do still store and compare alpha values since a change in alpha values might indicate a bug affecting similar tests.

    The actual values stored in the framebuffer come from whatever the app tells us to do. Often times, the values are garbage (from using math on all four channels that makes sense with RGB, but not alpha). Sometimes, there is a pattern that makes sense (e.g., background = 0, foreground = 255). In any event, the alpha that is present often doesn't fit the standard "transparent PNG" model that the current picture compare tool implements.

    Stripping alpha as a preprocessing step doesn't quite work for my workflow, which goes like this:

    - start with a folder of "known (or suspected) good" images
    - build a folder of "new" images that don't exactly match the "good" ones
    - compare the two folders, updating the ones that don't match
    - copy "new" images to "known good" if they pass inspection

    If I strip out alpha before comparing, the copied images would still have alpha stripped out and couldn't be used for future exact match comparisons that include alpha. The transparency support in BC3 and BC4 for images makes the inspection part hard, so I am using a BC2 to manage the directory updates and a combination of BC2 (with its lack of alpha support) and external tools to inspect image changes.

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,525

    Default

    Ok, thanks for the additional information.

    I wasn't suggesting batch removing the alpha channel. In Beyond Compare's "File Format" settings you can set up an external conversion which is run as part of the comparison and works on temporary files. The originals aren't modified. Take a look at the "EXIF headers" format on our Additional File Formats page for an example of how it works and how to set it up.
    ZoŽ P Scooter Software

  7. #7
    Join Date
    Apr 2010
    Posts
    9

    Default

    Oh, thanks -- I'm pretty sure I understand.

    With this external conversion operation and a new "File Format" rule, I could configure BC4 to diff .PNG images as though the alpha channel weren't even there (like BC2 would do). But when I approve changes, I'll be copying the unfiltered files with the original alpha data there. That approach seems like it would operate as though my proposed feature (1) were turned on all the time.

    I suppose I could turn the feature on and off by toggling the enable for the new file format, though leaving conversions on full-time suits my purposes pretty well. (I suppose I'd still have to shell out to see the original alpha values.) I assume that there's no easy way to do this programmatically? I couldn't see anything relevant in the scripting reference.

    That might be worth investigating.

  8. #8
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,908

    Default

    Hello,

    The conversion would only occur when you view the files in the Picture Compare. If you perform a copy from left->right, then that would just copy the file. How would you 'approve' your changes?
    Aaron P Scooter Software

  9. #9
    Join Date
    Apr 2010
    Posts
    9

    Default

    Quote Originally Posted by Aaron View Post
    Hello,

    The conversion would only occur when you view the files in the Picture Compare. If you perform a copy from left->right, then that would just copy the file. How would you 'approve' your changes?
    The way I do it with BC2 now is:

    - Open directory comparison with "new" folder on the left, "good" folder on the right, with "left newer and orphans" view.
    - Open the first image difference in the picture comparison tool to see if new image is good.
    - Repeat for more image differences (Ctrl-M to jump to next file).
    - Copy any good images from left to right.

    Applying the external conversion step suggested by Greg should work in this flow just fine, other than having no way to inpect the alpha channel inside BC4.

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,525

    Default

    ImageMagick has lots of different conversions you can use, including extracting the alpha channel as a grayscale image. Here are the steps you'll need to do everything:

    1) Create a new picture file format "No Alpha" with whatever you need as the mask (e.g., "*.png"), and this as the external conversion command line:

    "C:\Program Files\ImageMagick\convert.exe" %s -alpha off PNG:%t
    2) Create another new picture file format, "Alpha Only", with an empty mask and with this as the external conversion command line:

    "C:\Program Files\ImageMagick\convert.exe" %s -channel A -separate PNG:%t
    3) If you only want the "No Alpha" format to apply to certain folder compare sessions you can selectively check/uncheck it in the Folder Compare's Session Settings dialog, on the "Misc" tab.

    4) When you have an image loaded and you want to see the alpha channel, click the "Rules" button, switch to the "Format" tab, and select "No Alpha" from the "Left" and/or "Right" dropdowns, then click "Ok".

    That last step is a bit convoluted because the picture compare doesn't currently have the "Format" dropdown on its toolbar, and we'll look into changing that.

    Also, the "PNG" bit in the command lines is the target format for the output file. "BMP" should theoretically work, but I just found a bug in the BMP autodetection that's preventing that.
    ZoŽ P Scooter Software

Posting Permissions

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