Howto convert PIX pictures on PC

Help
2008-01-28
2013-04-22
  • Wim Bokkers
    Wim Bokkers
    2008-01-28

    Hi,

    Is there a way to convert PIX pictures, created with BRL-CAD on Windows to a different format (e.g. JPG, BMP, PNG)?

    We tried to convert using a raw converter (Paint Shop Pro, Adobe Photoshop), but the picture will get distorted.

    Another question: when is the new BRL-CAD release for Windows scheduled?

    Kind regards,
    Wim Bokkers

     
    • Sean Morrison
      Sean Morrison
      2008-01-28

      Hey Wim,

      There are a variety of image converters that will do the trick although only a couple were included in the 7.8.0 Windows release.  Looking at the list, though, it does seem that pix-fb and fb-png are provided so that would be one way to convert from pix to png (normally you'd just use pix-png).

      # example with a 1024x1024 rendered pix image
      fbserv -S1024 3 /dev/ogl  (or /dev/wgl after 7.10.0) &
      pix-fb -F3 -s1024 somefile.pix
      fb-png -F3 -s1024 somefile.png

      If you have a more current build, that just becomes:

      pix-png -s1024 < somefile.pix > somefile.png

      You should also be able to open the files using Photoshop, PSP, or Gimp (with the raw plugin).  Our pix files are first quadrant headerless raw image files with three interleaved 8-bit channels of RGB image data.  You may need to rename the .pix with a .raw image extension depending on the application and/or specify the file type manually (e.g. in Photoshop, you should select "Photoshop RAW" otherwise it will think it's an Alias PIX) .  You will probably need to specify the image dimensions during import since raw image files don't contain their dimensions.  You will definitely then need to vertically flip the image so that it's corresponds to a fourth quadrant instead of first.

      The Windows release is getting pretty close, the goal being early February.  Bob and others (though mostly Bob) have been working hard at fixing up a lot of the Windows-specific issues for several months now and he's not far from completion.  The TODO file lists the items that are planned as necessary before the next release goes out.

      Cheers!
      Sean

       
    • Wim Bokkers
      Wim Bokkers
      2008-01-29

      Thank you Sean,

      We tried it using the framebuffer, but even then (parts of) the image will get distorted.
      Is it possible that the distortion takes place within BRL-CAD on generating the pix file?
      (Using the raytrace control panel for displaying on /dev/ogl works as expected, but as soon a pix file is created, this pix file is distorted)

      Hopefully a new release will solve these problems.

      Wim

       
      • Sean Morrison
        Sean Morrison
        2008-01-29

        Hm, that very well could be a bug that Bob recently fixed.  Some of the image processing tools are reading/writing after an open() or fopen() without specifying O_BINARY or r+b respectively, etc, so Windows is defaulting to text-mode for those files/pipes/sockets.  That has been causing image and data file distortion for lots (hundreds) of tools that have to be identified and fixed one at a time.  With the file opened in text-mode, Windows is automatically injecting carriage returns when it encounters a newline value causing really bizarre image distortion dependent upon the image being processed but usually distinguished by the image "melting" to the left with odd color shifts.

        The new release solves that problem with most/all of the tools presently available as well as makes the pix-png tool available (among many others).

        Cheers!
        Sean

         
        • Wim Bokkers
          Wim Bokkers
          2008-01-29

          Ok. I see. I know of that default Windows behavior when using fopen. We also had problems with it in the past.
          Can happen.

          Can't wait to see the new release... ;-)

          Thank you for your help!

           
    • Wim Bokkers
      Wim Bokkers
      2008-01-29

      We managed to get good results by first opening a frame buffer with fbserv, then using the rt command with the -F option and then using fb-png. This way we do not have to rely on pix as an intermediate format.