mailing-list for TeXmacs Users

Text archives Help


How to resize images


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: How to resize images
  • Date: Tue, 13 May 2003 16:03:26 +0200

On Tue, May 13, 2003 at 02:42:02PM +0200, Joris van der Hoeven wrote:
> > - I just inserted a image. How can I resize it. The documentation says
> > that
> > this is possible, but not how it is done.
>
> Place yourself behind it and type backspace. Next, fill out
> the entries (someone has a pointer to a place in the archives
> where this is explained in detail?)

This message.

To resize an image, you have to edit the parameters of the image node.

First, place the caret just after the image. The left foot of the
editor window should read "postscript image".

Then press backspace. That will _deactivate_ the image allowing you to
access its internal values.

The parameters of a POSTSCRIPT node (i.e. an image are)

1. file name, if the image is linked, or image raw data if
the image is included;

2. width;

3. height

4. left cropping;

5. bottom cropping;

6. width copping;

7. height cropping


File name or raw image data.
----------------------------

Generally, you will not want to change the file name. But there is an
important case where that can be useful: if you link an image inside
an unnamed document (that is document you do not have already saved),
an absolute file name will be used. So if you later rename or move the
linked image file, the image will no longer be displayed by TeXmacs.

In this scenario, you may want to edit the image file name to use a
relative file name instead. Such file names are intepreted relative to
the directory containing the document. Relative file names are used
automatically when linking an image from a named document.

When an image is included, you will not want to edit the raw data
(unless you can read and write binary data or PostScript code in the
text).


Width and height
----------------

The width and height of an image can be specified using any length
unit or a special "zoom factor" syntax. If either one is ommited (left
empty), the other dimension is inferred by preserving the aspect ratio
of the image. If none is specified, TeXmacs will try to guess the
intended size of the image from the EPS headers (and will generally
get it wrong).

For more informatio about lengh units see chapter [?].

You can find some information on the wiki too:

http://www.alqua.com/tmresources/how%20to%20use%20length%20units
http://www.alqua.com/tmresources/length%20units

One especially useful length unit here, at least when dealing with
scalable graphics, is the "par" unit. Setting the image width to
".7par" will make your image occupy 70% of the paragraph width.

The "zoom factor" syntax allows to specify a rational multiplicator to
the EPS specified size of the image. It is best described by examples:

*3 -- multiply <dimension> by 3;

/2 -- divide <dimension> by 2;

*3/2 -- multiply dimension by 1.5;

*1.5 -- same as above.


Cropping
--------

In some situations, you may want texmacs to perform some cropping over
an image. For example, that may be necessary if you want to remove
some borders around an PostScript file you cannot easily edit.

In the following picture, the box in dashed lines represent the
complete image, and the smaller box in filled lines represent the
displayed cropped image.

+ - - - - - - - - - - - - - - - - - -
left cropping |
|-------------------->
. |
| width cropping .
-----------------------------> |
| . .
. . |
| ^.. +--------+
| | | |
| ^................ +--------+
| | |
| | bottom | height
| cropping | cropping |
| | |
- - - - - - - - - - - - - - - - - - +

The cropping values must be absolute length units. They are applied on
the image before scaling, so changing the displayed width or height of
the image will not affect cropping.


Examples
--------

<postscript|/usr/share/pixmaps/texmacs.xpm||||||>

Should display the texmacs icon at intrinsic size if texmacs were
correctly installed.

<postscript|chart.eps||||||>

Display the chart.eps file located in the same directory as the
document.

<postscript|chart.eps|.7par|||||>

Scale it to take 70% of the paragraph width.

<poscript|chart.eps||.5pag||||>

Scale to take 50% of the page height.

<postscript|chart.eps|*4|||||>
<postscript|chart.eps||*4||||>
<postscript|chart.eps|*16/4|||||>

Magnify by a factor 4.

<postscript|chart.eps|/2|||||>
<postscript|chart.eps|*.5|||||>
<postscript|chart.eps||/2||||>
<postscript|chart.eps|*2/4|||||>

Shrink by a factor 2.

<postscipt|archimedes.eps|*22/7||2cm|2cm|3cm|3cm>

Crop out a square image of 1cm on the side locate 2cm from the
lower left border and magnify it by approximately pi.

--
-- ddaa


  • How to resize images, David Allouche, 05/13/2003

Archive powered by MHonArc 2.6.19.

Top of page