Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 25 Apr 2014, 02:08
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Graphics
Sam2p: commandline
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
muggins

Joined: 20 Jan 2006
Posts: 6668
Location: lisbon

PostPosted: Sun 24 Aug 2008, 23:40    Post subject:  Sam2p: commandline  

http://www.inf.bme.hu/~pts/sam2p/

Quote:

sam2p is a UNIX command line utility written in ANSI C++ that converts many raster (bitmap) image formats into Adobe PostScript or PDF files and several other formats. The images are not vectorized. sam2p gives full control to the user to specify standards-compliance, compression, and bit depths. In some cases sam2p can compress an image 100 times smaller than the PostScript output of many other common image converters. sam2p provides ZIP, RLE and LZW (de)compression filters even on Level1 devices.


I use this program quite a bit, and thought I'd post it as it has a lot of functionality contained in the one small program. e.g to convert a .gif to a .png is as simple as:

Code:
sam2p xxx.gif xxx.png


To convert an entire directory of .gif files, you could do:

Code:

#!/bin/bash

directory=`pwd`

for file in $directory/*.gif
do
   filename=${file%.gif}
   sam2p $filename.gif $filename.png
done


If you run the program without any arguments, sam2p is very modest about it's abilities. You really need to refer to the online README to see it's many options.
sam2p-0.47-i486.pet
Description 
pet

 Download 
Filename  sam2p-0.47-i486.pet 
Filesize  199.18 KB 
Downloaded  652 Time(s) 

Last edited by muggins on Tue 23 Nov 2010, 01:15; edited 6 times in total
Back to top
View user's profile Send private message 
Dingo


Joined: 11 Dec 2007
Posts: 1411
Location: somewhere at the end of rainbow...

PostPosted: Wed 27 Aug 2008, 18:59    Post subject:  

a dumb question.

assuming I have several images in a directory I want convert all together into one pdf file, How can I made this with samp2p?

_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
muggins

Joined: 20 Jan 2006
Posts: 6668
Location: lisbon

PostPosted: Wed 27 Aug 2008, 20:57    Post subject:  

Dingo,

AFAIK, whilst sam2p can create individual .pdf files from images, it can't then merge the .pdf files into a single .pdf. If that's what you wanted, then you could create individual .pdf files from .jpg files, by altering the above script to:

Code:

#!/bin/bash


directory=`pwd`

for file in $directory/*.jpg
do
   filename=${file%.jpg}
   sam2p $filename.jpg $filename.pdf
done


save this with an appropriate name, like /usr/bin/jpg2pdf, give it executable permissions, then run it on the target directory, then use Disciple's joinPdf to merge them all into the one file.
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6668
Location: lisbon

PostPosted: Fri 10 Apr 2009, 09:17    Post subject:  

Uploaded v0.46.
Back to top
View user's profile Send private message 
kuapao

Joined: 01 Jul 2008
Posts: 94

PostPosted: Wed 22 Apr 2009, 00:31    Post subject: here's the libjpeg PET file that's missing in Puppy 4.x
Subject description: for use with sam2p
 

This is a very useful utility, thanks for posting it!

The program cjpeg is required to convert to JPEGs. I've posted it here.
libjpeg62_6b-14-i386.pet
Description  libjpeg62_6b-14-i386 from Debian package
pet

 Download 
Filename  libjpeg62_6b-14-i386.pet 
Filesize  76.8 KB 
Downloaded  689 Time(s) 
Back to top
View user's profile Send private message 
Dingo


Joined: 11 Dec 2007
Posts: 1411
Location: somewhere at the end of rainbow...

PostPosted: Mon 08 Jun 2009, 05:44    Post subject:  

I'am using sam2p in puppy 3.01. strange error message showed today:

Quote:
# sam2p logo.png logo.pdf
This is sam2p v0.46.
Available Loaders: PS PDF JAI PNG JPEG TIFF PNM BMP GIF LBM XPM PCX TGA.
Available Appliers: XWD Meta Empty BMP PNG TIFF6 TIFF6-JAI JPEG-JAI JPEG PNM GIF89a+LZW XPM PSL1C PSL23+PDF PSL2+PDF-JAI P-TrOpBb.
png22pnm: /usr/lib/libpng12.so.0: no version information available (required by png22pnm)


what's?

_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
muggins

Joined: 20 Jan 2006
Posts: 6668
Location: lisbon

PostPosted: Mon 08 Jun 2009, 06:00    Post subject:  

@Dingo,

I think it's just a libpango incompatibility between that used on p412, (where I compiled sam2p & png22pnm) & the one on p301. Was it working before & just stopped working? I don't have a p301 environment...can you compile apps? If you have the relevant devx working, then it compiles easily & is just a matter of downloading tif22pnm-latest.tar.gz & sam2p-latest.tar.gz, then extracting both, changing to the respective directories, then:

Code:
./configure --prefix=/usr
make
make install
Back to top
View user's profile Send private message 
Dingo


Joined: 11 Dec 2007
Posts: 1411
Location: somewhere at the end of rainbow...

PostPosted: Mon 08 Jun 2009, 06:27    Post subject:  

thanks I'm very busy actually. I have not a devx already configured as sfs module, so, I'll use develpup derivative to compile (I remember develpup was build from 3.01 puppy)
_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Thu 10 Sep 2009, 11:17    Post subject:  

Hi Dingo !
Code:

# sam2p logo.png logo.pdf
This is sam2p v0.46.
Available Loaders: PS PDF JAI PNG JPEG TIFF PNM BMP GIF LBM XPM PCX TGA.

you should try this syntax instead: returns «Success» when done
Code:

# sam2p logo.png PDF: logo.pdf
...
Success
#

If already known that disregard this post.
Cheers
Charlie
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6668
Location: lisbon

PostPosted: Fri 11 Sep 2009, 20:43    Post subject:  

Uploaded v0.47.
Back to top
View user's profile Send private message 
Dingo


Joined: 11 Dec 2007
Posts: 1411
Location: somewhere at the end of rainbow...

PostPosted: Sun 17 Jan 2010, 19:50    Post subject: sam2p for puppy linux 3.01  

Sorry for delay Cool

For the joy of Puppy 3.01 users, here I compiled sam2p (with lzw and gif support enabled) without annoying warning about libpng

download here

_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Thu 29 Jul 2010, 04:29    Post subject:  

Hi Dingo,
sorry for ... delay
Dingo wrote:
a dumb question.
assuming I have several images in a directory I want convert all together into one pdf file, How can I made this with samp2p?


Not that much dumb ...

using GQView (it has been part of several puppy distros and there is a pet somewhere):

Provided you have a CUPS-PDF printer installed, and have your images stored into the same folder, just
open GQView and open that folder ;
in the left window of the dialog box, highlight (keep CTRL key pressed + mouse or up/down keys) all the images to print into one file;
then File/print;
there you may choose the CUPS-PDF printer
+ other settings as the scale (important: if one image is printed on more than one page, adjust the scale),
number of image printed on one page,
print image file name, etc...,
adjust resolution;
then chose also where to save the pdf file;
then OK
and ... it is done !

Hope this helps!
Cheers, Charlie
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6668
Location: lisbon

PostPosted: Thu 29 Jul 2010, 22:55    Post subject:  

Hello Charlie,

I think Dingo already has a solution, using sam2p. See here:

http://murga-linux.com/puppy/viewtopic.php?t=57368
Back to top
View user's profile Send private message 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Sat 31 Mar 2012, 08:37    Post subject:
Subject description: later sam2p-0.49 december 2011
 

Hi,
here is the sam2p later version pet (compiled on Exprimo kernel 3.2.11
Have fun
Charlie
edited: comment erased
edited 13 october 2012: right click conversion pets PNG <==> PS files

notes:
0. ...quite trivial ...sam2p MUST be installed ... Wink
1. The above may be modified for other conversion by the user: just edit and rename the /usr/local/bin script accordingly; as also the folder, var and symlinks name in the pets; then rename the pet name before making the new pet.
2. the resolution of the output file may be modified using the sam2p options; see sam2p instructions:
sam2p instructions and FAQ extract wrote:
Q39. Can sam2p load an EPS or PDF file with an arbitrary resoultion?

A39. Yes. For example use one of

sam2p -l:gs=-r216 in.eps out.png
sam2p -l:gs=-r216 in.pdf out.png

to have resoultion 216 DPI (image scaled 3 times to both directions).
Without scaling, 72 DPI is the default.

3. not to forget ...thanks also to forum member don570 for his work in developping right-click application
Have fun
Charlie
sam2p_right-click-PS_to_PNG-0.0.1.pet
Description  right click PS to PNG conversion
pet

 Download 
Filename  sam2p_right-click-PS_to_PNG-0.0.1.pet 
Filesize  3.29 KB 
Downloaded  388 Time(s) 
sam2p_right-click-PNG_to_PS-0.0.1.pet
Description  right click PNG to PS conversion
pet

 Download 
Filename  sam2p_right-click-PNG_to_PS-0.0.1.pet 
Filesize  3.23 KB 
Downloaded  392 Time(s) 
sam2p-0.49.1-i486.pet
Description  sam2p-0.49.1-i486.pet
pet

 Download 
Filename  sam2p-0.49.1-i486.pet 
Filesize  224.66 KB 
Downloaded  287 Time(s) 
Back to top
View user's profile Send private message 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Tue 25 Mar 2014, 12:42    Post subject: compiling png22pnm and tif22pnm  

Hi,
using sam2p-v-0.49 on wheezy-3.5.2.11:
while converting from png to pdf:
as reported in an above post, i got the comment png22pnm was missing.
So got a try to compile it:
upon the make step, i got the error message:
Quote:
...
/usr/bin/ld: png22pnm.o: undefined reference to symbol 'pow@@GLIBC_2.0'
/usr/bin/ld: note: 'pow@@GLIBC_2.0' is defined in DSO /lib/libm.so.6 so try adding it to the linker command line
/lib/libm.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [compiled.stamp] Error 1

which tells that ld does not see libm.so.6 ;
to fix it:
just do what the linker (i.e. /usr/bin/ld) tells to do:
edit cc_help.sh in geany and add -lm - standing for libm , letting drop down the «-ib-» characters - , for instance to line with LIBS_PNG , as also to line with LDFLAG (found in another post):
here is the modified code of folder-where-compiling/tif22pnm-0.14/cc_help.sh
Code:
if test x"$CC" = x; then
  CC='gcc'
fi
prefix='/usr'
LD='gcc'
LIBS_PNG='-lpng -lm'
LIBS_TIFF='-ltiff '
ENABLE_DEBUG='assert'
GFLAG='-g'
CFLAGS=' '
CFLAGSB=' -ansi -pedantic -Wall -W -Wnested-externs -Wbad-function-cast -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wcast-align -Winline -Wcast-qual -Wmissing-prototypes'
LDFLAGS='-lm'
# ^^^ -L...
CPPFLAGS=''
# ^^^ -I...
# CCXX=... LDXX=...


when done, just run
# make clean
and then compile again running
# make

sorry if this looks academic ... Confused Embarassed

here is a link that helped me to fix this
http://linuxowy.blogspot.be/2012/03/compile-sam2p-on-fedora-16-64-bit.html

hope this helps
charlie
tif_png22pnm_wheezy-i386.pet
Description 
pet

 Download 
Filename  tif_png22pnm_wheezy-i386.pet 
Filesize  34.27 KB 
Downloaded  22 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Graphics
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0807s ][ Queries: 13 (0.0063s) ][ GZIP on ]