Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » FAQs » How can I get an image from AFNI into a paint/drawing program?

How can I get an image from AFNI into a paint/drawing program?

Document Actions
Up to table of contents

Q57. How can I get an image from AFNI into a paint/drawing program?
Once you have made the image window look like what you want to see, the steps are:
  1. Make sure the image window Save button says "Save:one". If necessay, open the Disp control sub-window and switch the save setting to "Save One". This will make the image saving function save the image (or montage) as it is shown on the screen.
  2. Press Save:one. You will get a popup box that asks you for a filename prefix. Enter something; for example, Elvis. Then press the Set button on the popup box. This will write out the file in the format used by the netpbm package (either the PGM or PPM format, depending on if the image saved was grayscale or color). In the example, the filename would be Elvis.pnm.
  3. Now you need to get the image into a format that your other software will like:
    • If you use the Unix+X11 program xpaint, it can read PGM/PPM (collectively called PNM format) images directly.
    • If you use a PC or MAC, a TIFF formatted file will usually work. (TIFF is not actually one format, but a family of formats. I usually use a LZW-compressed TIFF image to save disk space - most software that I use seems to be able to handle this TIFF sub-format.) Conversion can be done on Unix using the xv program (with a graphics interface, available here):
      1. Type the command: xv Elvis.pnm
      2. Click mouse button 3 in the xv image window - this will popup the xv control panel.
      3. Click on the Save button in the control panel. This will popup another control panel.
      4. At the top of the Save control panel, change the Format to TIFF. You may also want to change the output filename, which is entered at the bottom of the Save control panel. Then press the Ok button. You can then choose the compression type.

      The command line program pnmtotiff can also do the conversion from PNM to TIFF format. (This is part of the netpbm package - source code available at the AFNI distribution sites - which is often pre-installed on Linux systems.) The command to use would be something like

      
        pnmtotiff Elvis.pnm > Elvis.tif
      
    • Other netpbm conversion program that you might want to use include ppmtopcx and ppmtobmp, for converting to the PCX and BMP formats, respectively (in the latter case, you probably want to use the -windows option, since the default is to create an OS/2 format file!). All the netpbm programs come with Unix man pages, and most of them have -help options as well.
    • The convert program (part of the ImageMagick software package) can convert image files between a vast number of formats.
    • The gimp program, a Linux Photoshop-like drawing program, can also do image file conversion, as well as letting you draw on top of your images.
After the conversion, you will need to transport the file to the desired system, via a network, a floppy diskette, voudon chants, or whatever.

[29 Jun 2001] AFNI can now save images from the image viewing windows in a variety of formats, using external programs:

  • JPG format (using program cjpeg)
  • GIF format (using program ppmtogif)
  • TIF format (using program ppm2tiff or pnmtotiff)
  • BMP format (using program ppmtobmp)
  • EPS format (using program pnmtops)
  • PDF format (using programs pnmtops and epstopdf)
  • PNG format (using program pnmtopng)

For AFNI to use them, these programs must be in your path when AFNI starts up. You can change the default save format using the Disp image viewer control panel, or by right-clicking (Button 3) on the image viewer Save: button.

  • These programs are installed on many Linux distributions by default. Many of them are in the netpbm package, if you need to load them from CD or an online update service (e.g., Redhat, Mandrake, Debian).
  • For Solaris, you can get precompiled binaries for these programs from http://sunfreeware.com/.
  • For SGI IRIX, you can get precompiled binaries for these programs from http://freeware.sgi.com/index.html.
  • For HP-UX, you can get precompiled binaries for these programs from http://hpux.cs.utah.edu/.
  • For Mac OS X, you can get precompiled binaries for these programs from http://fink.sourceforge.net/ (but you have to install the Fink package to manage the process).

If you want to make an animated GIF from a collection of images, see Q26. If you want to search for a place to get some of the above programs, try Google.

[Answer created 12 Oct 1999, per the suggest of MSB; edited 29 Jun 2001]

This FAQ applies to: Any version.

Created by Robert Cox
Last modified 2005-08-01 14:18
 

Powered by Plone

This site conforms to the following standards: