• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

.PS to GIF conversion - Truncates the image

New Here ,
Nov 27, 2009 Nov 27, 2009

Copy link to clipboard

Copied

Dear all,

I have a image file in .ps format. When I try to convert it to GIF or JPEG or PDF format, I could see that the image is truncated the right. But when I chnage the .ps file to be in LandScape mode the image conversion is proper.

But I want the image to be converted in Portrait mode without image truncation.

Can any any one help me out in resolving this issue in .ps file.

Can something be done by chnaging the .ps file so that, I can get complete image

Given the postsript content below:

--------------------

%!PS
%%Version: 3.15
%%DocumentFonts: (atend)
%%Pages: (atend)
%%EndComments
%ident  "@(#)lp:filter/postscript/postscript/dpost.ps   1.1"
%
% Version 3.16 prologue for troff files.
%

/#copies 1 store
/aspectratio 1 def
/formsperpage 1 def
/landscape false def
/linewidth .3 def
/magnification 1 def
/margin 0 def
/orientation 0 def
/resolution 720 def
/xoffset 0 def
/yoffset 0 def

/roundpage true def
/useclippath true def
/pagebbox [0 0 612 792] def

/R  /Times-Roman def
/I  /Times-Italic def
/B  /Times-Bold def
/BI /Times-BoldItalic def
/H  /Helvetica def
/HI /Helvetica-Oblique def
/HB /Helvetica-Bold def
/HX /Helvetica-BoldOblique def
/CW /Courier def
/CO /Courier def
/CI /Courier-Oblique def
/CB /Courier-Bold def
/CX /Courier-BoldOblique def
/PA /Palatino-Roman def
/PI /Palatino-Italic def
/PB /Palatino-Bold def
/PX /Palatino-BoldItalic def
/Hr /Helvetica-Narrow def
/Hi /Helvetica-Narrow-Oblique def
/Hb /Helvetica-Narrow-Bold def
/Hx /Helvetica-Narrow-BoldOblique def
/KR /Bookman-Light def
/KI /Bookman-LightItalic def
/KB /Bookman-Demi def
/KX /Bookman-DemiItalic def
/AR /AvantGarde-Book def
/AI /AvantGarde-BookOblique def
/AB /AvantGarde-Demi def
/AX /AvantGarde-DemiOblique def
/NR /NewCenturySchlbk-Roman def
/NI /NewCenturySchlbk-Italic def
/NB /NewCenturySchlbk-Bold def
/NX /NewCenturySchlbk-BoldItalic def
/ZD /ZapfDingbats def
/ZI /ZapfChancery-MediumItalic def
/VR /Varitimes#Roman def
/VI /Varitimes#Italic def
/VB /Varitimes#Bold def
/VX /Varitimes#BoldItalic def
/S  /S def
/S1 /S1 def
/GR /Symbol def

/inch {72 mul} bind def
/min {2 copy gt {exch} if pop} bind def

/setup {
        counttomark 2 idiv {def} repeat pop

        landscape {/orientation 90 orientation add def} if
        /scaling 72 resolution div def
        linewidth setlinewidth
        1 setlinecap

        pagedimensions
        xcenter ycenter translate
        orientation neg rotate
        width 2 div neg height 2 div translate
        xoffset inch yoffset inch translate
        margin 2 div dup neg translate
        magnification dup aspectratio mul scale
        scaling scaling scale

        /Symbol /S Sdefs cf
        /Times-Roman /S1 S1defs cf
        0 0 moveto
} def

/pagedimensions {
        useclippath userdict /gotpagebbox known not and {
                /pagebbox [clippath pathbbox newpath] def
                roundpage currentdict /roundpagebbox known and {roundpagebbox} if
        } if
        pagebbox aload pop
        4 -1 roll exch 4 1 roll 4 copy
        landscape {4 2 roll} if
        sub /width exch def
        sub /height exch def
        add 2 div /xcenter exch def
        add 2 div /ycenter exch def
        userdict /gotpagebbox true put
} def

/pagesetup {
        /page exch def
        currentdict /pagedict known currentdict page known and {
                page load pagedict exch get cvx exec
        } if
} def

/decodingdefs [
        {counttomark 2 idiv {y moveto show} repeat}
        {neg /y exch def counttomark 2 idiv {y moveto show} repeat}
        {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat}
        {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat}
        {counttomark 2 idiv {y moveto show} repeat}
        {neg setfunnytext}
] def

/setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def

/w {neg moveto show} bind def
/m {neg dup /y exch def moveto} bind def
/done {/lastpage where {pop lastpage} if} def

/f {
        dup /font exch def findfont exch
        dup /ptsize exch def scaling div dup /size exch def scalefont setfont
        linewidth ptsize mul scaling 10 mul div setlinewidth
        /spacewidth ( ) stringwidth pop def
} bind def

/changefont {
        /fontheight exch def
        /fontslant exch def
        currentfont [
                1 0
                fontheight ptsize div fontslant sin mul fontslant cos div
                fontheight ptsize div
                0 0
        ] makefont setfont
} bind def

/sf {f} bind def

/cf {
        dup length 2 idiv
        /entries exch def
        /chtab exch def
        /newfont exch def

        findfont dup length 1 add dict
        /newdict exch def
        {1 index /FID ne {newdict 3 1 roll put} {pop pop} ifelse} forall

        newdict /Metrics entries dict put
        newdict /Metrics get
        begin
                chtab aload pop
                1 1 entries {pop def} for
                newfont newdict definefont pop
        end
} bind def

%
% A few arrays used to adjust reference points and character widths in some
% of the printer resident fonts. If square roots are too high try changing
% the lines describing /radical and /radicalex to,
%
%       /radical        [0 -75 550 0]
%       /radicalex      [-50 -75 500 0]
%

/Sdefs [
        /bracketlefttp          [220 500]
        /bracketleftbt          [220 500]
        /bracketrighttp         [-70 380]
        /bracketrightbt         [-70 380]
        /braceleftbt            [220 490]
        /bracketrightex         [220 -125 500 0]
        /radical                [0 0 550 0]
        % NeWSprint's \(br is too low, compensate
        statusdict /product get (NeWS Server) eq {
                /radicalex              [-50 100 500 0]
                /parenleftex            [-20 100 0 0]

        } {
                /radicalex              [-50 0 500 0]
                /parenleftex            [-20 -170 0 0]
        } ifelse
        /integral               [100 -50 500 0]
        /infinity               [10 -75 730 0]
] def

/S1defs [
        /underscore             [0 80 500 0]
        /endash                 [7 90 650 0]
] def
%%EndProlog
%%BeginSetup
mark
%%FormsPerPage: 2
/formsperpage 2 def
setup
2 setdecoding
%%EndSetup
%%Page: 1 1
save
mark
1 pagesetup
14 I f
(Sp)1220 882 w
11 S f
(-)1378 924 w
14 I f
(A)1439 882 w
14 S f
(\354)1547 799 w
(\356)1547 939 w
14 I f
(UtranCell)1616 882 w
14 S f
(\374)2208 799 w
(\376)2208 939 w
(=)2277 882 w
14 R f
(100)2354 882 w
14 S f
(\351)2587 799 w
(\353)2587 939 w
14 R f
(%)2657 882 w
14 S f
(\371)2796 799 w
(\373)2796 939 w
(\264)2849 882 w
14 I f
(pmTotNoRrcConnectReqCs)1387 1467 w
14 S f
(\354)2967 1384 w
(\356)2967 1524 w
14 I f
(UtranCell)3036 1467 w
14 S f
(\374)3628 1384 w
(\376)3628 1524 w
14 I f
(pmTotNoRrcConnectReqCsSucc)1255 1146 w
14 S f
(\354)3099 1063 w
(\356)3099 1203 w
14 I f
(UtranCell)3168 1146 w
14 S f
(\374)3760 1063 w
(\376)3760 1203 w
14 S1 f
(_ _____________________________________)1 2616 1 1234 1257 t
14 S f
(\264)3864 1299 w
14 I f
(pmNoNormalNasSignReleaseCs)1255 2052 w
14 S f
(\354)3094 1969 w
(\356)3094 2109 w
14 I f
(UtranCell)3163 2052 w
14 S f
(\374)3755 1969 w
(\376)3755 2109 w
(+)3824 2052 w
14 I f
(pmNoSystemNasSignReleaseCs)3901 2052 w
14 S f
(\354)5700 1969 w
(\356)5700 2109 w
14 I f
(UtranCell)5769 2052 w
14 S f
(\374)6361 1969 w
(\376)6361 2109 w
14 I f
(pmNoNormalNasSignReleaseCs)2558 1731 w
14 S f
(\354)4397 1648 w
(\356)4397 1788 w
14 I f
(UtranCell)4466 1731 w
14 S f
(\374)5058 1648 w
(\376)5058 1788 w
14 S1 f
(_ __________________________________________________________________________)1 5217 1 1234 1842 t
14 S f
(\264)6465 1884 w
14 I f
(pmNoRabEstablishAttemptSpeech)1255 2637 w
14 S f
(\354)3191 2554 w
(\356)3191 2694 w
14 I f
(UtranCell)3260 2637 w
14 S f
(\374)3852 2554 w
(\376)3852 2694 w
14 I f
(pmNoRabEstablishSuccessSpeech)1255 2316 w
14 S f
(\354)3192 2233 w
(\356)3192 2373 w
14 I f
(UtranCell)3261 2316 w
14 S f
(\374)3853 2233 w
(\376)3853 2373 w
14 S1 f
(_ ______________________________________)1 2709 1 1234 2427 t
cleartomark
showpage
restore
%%EndPage: 1 1
%%Trailer
done
%%DocumentFonts: Times-Italic Symbol Times-Roman
%%Pages: 1

--------------------------

Thanks in advance.

Regards,

Jawahar

TOPICS
Programming

Views

838

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Nov 30, 2009 Nov 30, 2009

Your PS file does not contain any page size and/or orientation settings, thus the PostScript interpreter you are using

simply sets the page size to the configured default.

As the file defines something like a page bounding box (the name pagebbox is used), take the values fiven there

to construct a page size statement. E.g. insert

<< /PageSize [792 612] >> setpagedevice

just after the comment lines (the lines beginning with percent signs). That forces your PS interpreter

(provided it speaks at least la

...

Votes

Translate

Translate
Contributor ,
Nov 30, 2009 Nov 30, 2009

Copy link to clipboard

Copied

Your PS file does not contain any page size and/or orientation settings, thus the PostScript interpreter you are using

simply sets the page size to the configured default.

As the file defines something like a page bounding box (the name pagebbox is used), take the values fiven there

to construct a page size statement. E.g. insert

<< /PageSize [792 612] >> setpagedevice

just after the comment lines (the lines beginning with percent signs). That forces your PS interpreter

(provided it speaks at least language level 2, which I silently assume) to render the formula on to a

letter size page in landscape orientation.

If you really want a portrait orientyation, you'd have to exchange the two numbers in the

statement above and insert code to scale down the formula.

Helge

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 02, 2009 Dec 02, 2009

Copy link to clipboard

Copied

LATEST

Hi Helge,

Thank you so much for you reply. I agree with you that the ps file doesn't contain any page size information. This I have set (Paper Size) in GostScript (ps interpreter) to get the image correctly without any truncation.

Thank you once again for help....

The switch I used while calling the GostScript was "-sPAPERSIZE=a3"

Best Regards,

Jawahar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines