[Index for tmp_for_tar/imgio] [Return to Master Index]

writegrayjpg

(tmp_for_tar/imgio/writegrayjpg.m)


Function Synopsis

writegrayjpg(fname, im, scale)

Help text

       writegrayjpg(fname, im)

 writegrayjpg   Write a gray-level image to a file in JPEG format.

		 writegrayjpg(fname, im, scale=1)
		 fname - file name.
		 im    - image to write into the file.
               scale - 0 - Don't scale values to [0,255]
                       1 - Scale values to [0,255]

                See also: writejpg, writepgm, writeppm.

 Created: 27.6.98.
 Version: 1.0



Listing of function file tmp_for_tar/imgio/writegrayjpg.m

##       writegrayjpg(fname, im)
##
## Copyright (C) 1998 Ariel Tankus
## 
## This program is free software.
## This file is part of the Image Processing Toolbox for Octave
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
##

## writegrayjpg   Write a gray-level image to a file in JPEG format.
##
##		 writegrayjpg(fname, im, scale=1)
##		 fname - file name.
##		 im    - image to write into the file.
##               scale - 0 - Don't scale values to [0,255]
##                       1 - Scale values to [0,255]
##
##                See also: writejpg, writepgm, writeppm.
##

## Author: Ariel Tankus <arielt@math.tau.ac.il>
## Created: 27.6.98.
## Version: 1.0

function writegrayjpg(fname, im, scale)

  if nargin<3, scale = 1 ; end
  command = sprintf("cjpeg  -quality 99 -greyscale -outfile %s", fname); 
  ## command = sprintf("cjpeg  -quality 100 -greyscale -outfile %s", fname); 
  ## command = sprintf("convert pgm:- %s", fname) 
  fid = popen(command, "w");
  writepgm(fid, im, scale);
  fclose(fid);

endfunction

Produced by oct2html on Sat Sep 14 9:47:03 2002
Cross-Directory links are: ON