Creating previews from image files and images

You will find a general example for the use of image here.

Version :
16.10.2024, 11:40 Uhr

Creating previews from image files and images

static Image alloc(char* path_or_url = 0)

Create a preview of a file. Image objects must be deleted again with image::release! Paths can be complete system paths (OS X) or URLs. The internal representation of the image is first set up when the image is actually required.

Name Type Default Description
Return Image   Preview of an image file or allocating a new empty image
path_or_url String or char* - Complete data file or URL to an image file. URLs only supported under Mac OS X.

If the parameter is missing (since version 2.0 R634 the parameter is allowed to be empty too), an empty image is allocated.
#include "internal/types.h"
img = image::alloc (path);

Get the preview of a template from the current database and save it onto the desktop.

#include "internal/types.h"
#include "internal/text.h"
int main () { Query qu = sql::query (sql::dbconnection ()); Image img = 0;
/// Init if (!qu) { showmessage ("No database connction"); return 0; }
img = image::alloc ();
// Retreive image query::send (qu, "select preview from pageitems where ID = 15"); query::output (qu, kImage, img); if (!query::exec(qu)) { query::close (qu); image::release (img); return 0; } while (query::fetch (qu)) {} query::close (qu);
// Save image file wlog ("", "Size of image : %d\n", image::bytes (img)); image::save (img, "$DESKTOP/aaa/pageitem15.jpg", 1); image::release (img);
return 0; }

You can load images from the internet directly. Attention : If you don't want an embedded image, you have to dump your image to a file using image::save and import the file using frame::image instead of frame::embed_image.

#include "internal/text.h"
#include "internal/types.h"
int main () { char imgFile [255]; int res; char dp [2000]; Image img = 0;
document::folder (dp); strcpy (imgFile, "http://www.hi13.de/Auto.JPG"); img = image::alloc (imgFile);
res = frame::embed_image (gFrame, img, kPlaceTopLeft, 0.0);
if (res == 0) wlog ("", "Embedding '%s' successfully finished\n", imgFile); else wlog ("", "Embedding '%s' done with error %d\n", imgFile, res); image::release (img);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

image::release

static Image preview(
  Image org,
  int size = 0,
  int resolution = 72,
  int color_depth = 24,
  char* format= "JPEG")

Mac only Create a preview of an image. Under Windows, a copy of the image is returned. The call creates a new image from the original. If the original is not yet loaded, it will be automatically loaded. Images created by preview must be deleted again with image::release.

Color depth cannot set on every image format (PICT, ...), in this cases it will be ignored.

Previews created with support from QuickTime, that is installed by default on Macintosh platforms only.
Format Available Hints
JPG, JPEG all  
TIF, TIFF
GIF
PICT Mac only Color depth is ignored for PICT
PNG
Photoshop
SGI
MacPaint
Targa
QuickDraw
QuickTime
Flash
FlashPix

Name Type Default Description
Return Image   Preview of the image
org Image - Original image
size int Original size size of the preview in pixels, 0 = original size
resolution int 72 Resolution in ppi
color_depth int 24 Color depth in bits/pixels
format String or char* "JPEG" Image format as string, see 'Image format' table
int main ()
{
    Image	img 	= image::alloc ("$DESKTOP/clara.JPG");
    Image	prv		= image::preview (img, 140, 72, 24, "JPG");
showmessage ("Original\n\nStatus : %d\nSize : %d",   image::error (prv),   image::bytes (prv)); showmessage ("Preview\n\nStatus : %d\nSize : %d",   image::error (prv),   image::bytes (prv));
image::release (img); image::release (prv); return 0; }


priint:comet InDesign® Plug-Ins

snapshot_page
snapshot_frame
snapshot_frames
snapshot_rect
release
alloc

static Image snapshot_page(
  ItemRef docRef,
  int pageNum = 1,
  int bounding = -1,
  char* format= "JPEG",
  int quality = 2,
  float resolution = 72.0)

Create a preview of a document page. For compatibility reasons between Mac and Windows only LPG, TIFF and GIF supported. You should delete the image using release.

On Mac platforms you can convert the snapshot to any other supported image format.

Name Type Default Description
Return Image   New created image or 0 in case of some errors
docRef ItemRef 0 document reference
0 : front document
pageNum int 1 1-base page number
bounding int kOriginalSize Size of frame in points to prpportionally scale the image
kOriginalSize : original size
format String or char* "JPEG" image format, one of the following

  JPG, JPEG
  GIF, GIFF
  TIF, TIFF

Any other values are creatig a JPEG.
quality int kAntiAliasing Various parameters. Valid settings are:

Antialiasing for all objects: kAntiAliasing

Full resolution graphics: kFullResGraphics

Draw gray: kDrawGray

Transparency:
 kXPOff
 kXPLow
 kXPMedium
 kXPHigh
 kXPMaximum

JPEG Quality (The setting effects only to the quality of the saved file, not of the preview itself!):
 kJPEGLowQuality
 kJPEGGoodQuality
 kJPEGExcellentQuality
 kJPEGGreatQuality

JPEG Encoding (The setting effects only to the quality of the saved file, not of the preview itself!):
 kJPEGBaseline
 kJPEGProgressive

Alpha Channel:
 kAddAlpha

quality can be supplied as a bitfield (kXXX... + kXXX + ...). The default value is:
kAntiAliasing
resolution float 72.0 Resolution of preview
#include "internal/types.h"

Create a 100x100 preview of the third page from the front document

int main ()
{
    Image	prv	= image::snapshot_page (0, 3, 100, "JPG");
showmessage ("State : %d\nSize : %d",   image::error (prv),   image::bytes (prv));
image::release (prv); return 0; }

Version 1.3.3, P/R 60, parameter quality since R2330 Parameter resolution since v3.3 R3601, 02. Apr. 2013

priint:comet InDesign® Plug-Ins, Illustrator

release
snapshot_frames
preview
comet.CPage.createSnapshot

static Image snapshot_frames(
  ItemList frames,
  int bounding = -1,
  char* format= "JPEG",
  int quality = 2,
  float resolution = 72.0)

Create a preview of document frames. For compatibility reasons between Mac and Windows only LPG, TIFF and GIF supported. You should delete the image using release.

On Mac platforms you can convert the snapshot to any other supported image format.

Name Type Default Description
Return Image   New created image or 0 in case of some errors
frames ItemList - List of valid frames
bounding int kOriginalSize Size of frame in points to proportionally scale the image
kOriginalSize : original size
format String or char* "JPEG" image format, one of the following

  JPG, JPEG
  GIF, GIFF
  TIF, TIFF

Any other values are creatig a JPEG.
quality int kAntiAliasing Various parameters. Valid settings are:

Antialiasing for all objects: kAntiAliasing

Full resolution graphics: kFullResGraphics

Draw gray: kDrawGray

Transparency:
 kXPOff
 kXPLow
 kXPMedium
 kXPHigh
 kXPMaximum

JPEG Quality (The setting effects only to the quality of the saved file, not of the preview itself!):
 kJPEGLowQuality
 kJPEGGoodQuality
 kJPEGExcellentQuality
 kJPEGGreatQuality

JPEG Encoding (The setting effects only to the quality of the saved file, not of the preview itself!):
 kJPEGBaseline
 kJPEGProgressive

Alpha Channel:
 kAddAlpha

quality can be supplied as a bitfield (kXXX... + kXXX + ...). The default value is:
kAntiAliasing + kAddAlpha
resolution float 72.0 Resolution of preview
#include "internal/types.h"

Create a 100x100 preview of the currently selected frames.

int main ()
{
    Image	img		= image::snapshot_frames (itemlist::selected (), 100);
showmessage ("State : %d\nSize : %d",   image::error (prv),   image::bytes (prv));
image::release (img); return 0; }

Version 1.3.3, P/R 60, Parameter quality seit R2330
Parameter resolution since v3.3 R3601, 02. Apr. 2013

priint:comet InDesign® Plug-Ins, Illustrator

release
snapshot_frames
preview

static Image snapshot_frame(
  ItemRef frame,
  int bounding = -1,
  char* format= "JPEG",
  int quality = 2)

Create a preview of a document frame. For compatibility reasons between Mac and Windows only LPG, TIFF and GIF supported. You should delete the image using release.

On Mac platforms you can convert the snapshot to any other supported image format.

Name Type Default Description
Return Image   New created image or 0 in case of some errors
frame ItemRef - valid frame (i. e. gFrame)
bounding int kOriginalSize Size of frame in points to proportionally scale the image
kOriginalSize : original size
format String or char* "JPEG" image format, one of the following

  JPG, JPEG
  GIF, GIFF
  TIF, TIFF

Any other values are creatig a JPEG.
quality int kAntiAliasing Various parameters. Valid settings are:

Antialiasing for all objects: kAntiAliasing

Full resolution graphics: kFullResGraphics

Draw gray: kDrawGray

Transparency:
 kXPOff
 kXPLow
 kXPMedium
 kXPHigh
 kXPMaximum

JPEG Quality (The setting effects only to the quality of the saved file, not of the preview itself!):
 kJPEGLowQuality
 kJPEGGoodQuality
 kJPEGExcellentQuality
 kJPEGGreatQuality

JPEG Encoding (The setting effects only to the quality of the saved file, not of the preview itself!):
 kJPEGBaseline
 kJPEGProgressive

Alpha Channel:
 kAddAlpha

quality can be supplied as a bitfield (kXXX... + kXXX + ...). The default value is:
kAntiAliasing
resolution float 72.0 Resolution of preview
#include "internal/types.h"

Create a 100x100 preview of the current script frame

int main ()
{
    Image	img		= image::snapshot_frame (gFrame, 100);
showmessage ("State : %d\nSize : %d",   image::error (prv),   image::bytes (prv));
image::release (prv); return 0; }

Version 1.3.3, P/R 60, parameter quality since R2330
Parameter resolution since v3.3 R3601, 02. Apr. 2013

priint:comet InDesign® Plug-Ins, Illustrator

release
snapshot_frames
preview

static int release(Image img)

If images are no longer required, the image data must in any case be deleted again!

Name Type Default Description
img Image - Image to be deleted
image::release (img);


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int error(Image img)

Error state of image. After creating or converting an image,you should ask, whether the action was successful.

Name Type Default Description
Return int   0 or ErrorCode
img Image - image of interest

Version 1.3.3, P/R 60

priint:comet InDesign® Plug-Ins

static int bytes(Image img)

Image size in bytes. You use this information for writing images to a database with limited blob size. For smaller images use preview or try to change the color depth or the format of the images (PNG or JPG)

Name Type Default Description
Return int   image size in bytes
img Image - image of interest

Version 1.3.3, P/R 60

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int save(
  Image img,
  char* path,
  int rmvOld = 0)

Save an image to a file. Non existing destination folders will be created automatically.

Name Type Default Description
Return int   0 or ErrorCode
img Image - image to save
path String or char* - full destination path. Be sure to choose an extender matching the image format. Non existing destination folders will created automatically.
rmvOld int 0 Delete existing file? 0 : Do not delete
otherwise : delete with no undo

Version 1.3.3, P/R 60

priint:comet InDesign® Plug-Ins, Illustrator

static int count_paths(ItemRef frameRef = 0)

Number of clip paths defined inside an image.

Name Type Default Description
Return int   Number of clip paths
0 : no graphic frame, no image, or no clip path
frameRef ItemRef 0 valid graphic frame
0 : gFrame, or, if gFrame is not defined, the first selected frame of the front document
Learn more about clip path usage at  this example

17. March 2006 (P/R38)

priint:comet InDesign® Plug-Ins

static char* pathname(ItemRef frameRef = 0, int index = 0)

Get the name of an indexed clip path.

Name Type Default Description
Return char*   Name of clip path.
"" : no graphic frame, no image, or no clip path

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

frameRef ItemRef 0 valid graphic frame

0 : current script frame
index int 0 0-based clip path index

Attention: The function cannot calculate the default clipping path kDefaultClipIndex.
#include "internal/types.h"
Learn more about clip path usage at  this example

17. March 2006 (P/R38)

priint:comet InDesign® Plug-Ins

static int pathindex(ItemRef frameRef, char* name)

Find the index of a named clip path. In case of an error, -1 is returned.

Name Type Default Description
Return int   0-based path index
-1 : no graphic frame, no image, or no clip path
frameRef ItemRef 0 valid graphic frame
0 : gFrame, or, if gFrame is not defined, the first selected frame of the front document
name String or char* - name of clip path
Learn more about clip path usage at  this example

17. March 2006 (P/R38)

priint:comet InDesign® Plug-Ins

static int clipindex(ItemRef frameRef = 0, int resolveDefault = 0)

Get the index of the currently used clip index. If the frame isn't a graphic frame or no clip path is set, 1- is returned.

Name Type Default Description
Return int   0-based index of currently used clip path
-1 : error or no clip path
kDefaultClipIndex (-4) : default clip path
frameRef ItemRef 0 valid graphic frame

0 : current script frame
resolveDefault int 0 If the default clipping path is used, shall I return the index of this path?

0 : No (The answer is still kDefaultClipIndex)

1 : Yes, the index of the default clipping is returned
#include "internal/types.h"
Learn more about clip path usage at  this example

17. March 2006 (P/R38)
Parameter resolveDefault since v4.0.5 R12112, 14. Jul 2016

priint:comet InDesign® Plug-Ins, comet_pdf

static int clippath(
  ItemRef frameRef,
  float* l = 0,
  float* t = 0,
  float* r = 0,
  float* b = 0)

Get the clip paths bounding box. Allvalues are relative to the image frame.

The function is identically with frame::image_getpath_bbox.

Name Type Default Description
Return int   0 : bounding box found
error code : no graphic frame or no clip path inside the image
frameRef ItemRef - valid graphic frame
l float* 0 left
t float* 0 top
r float* 0 right
b float* 0 bottom
Learn more about clip path usage at  this example

17. March 2006 (P/R38)

priint:comet InDesign® Plug-Ins

static int setclip(
  ItemRef frameRef = 0,
  int index = 0,
  int flags = 4,
  int clipToFrame = 0,
  float tolerance = 0.0,
  float minPathSize = 0.0,
  float Inset = 0.0)

Apply a clipping path. The clipping path must be defined inside the image.

Using comet_pdf even path indexes > 0 are intented to use the first clipping path of the image. All following parameters of the function are ignored. To define clipping paths with comet_pdf too, please use setclip2.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef 0 Valid frame reference

0 : current script frame
pathindex int kIgnoreClipping 0-based index of clipping path

kIgnoreClipping : Ignore clip setting

kResetClipping : Reset any existing clipping..

kDefaultClipIndex : Use the default clipping path. comet_pdf uses the index 0 in this case.

>= 0 : 0-based clipping path index
flags int kAllowHolesFlag How to clip the image? Values can be added.

kInvertFlag : Invert the resulting path by combining with a path equal to the bounds of the image.

kAllowHolesFlag : Ingored since v4.0.5 R18123!

kRestrictToFrameFlag : Ingored since v4.0.5 R18123!

Value is ignored by comet_pdf.
cliptoFrame int 0 Use the the clipping path as to be the frames path?

0 : Keep old frame
1 : Use clip path as frame
tolerance float 0.0 Ignoreed since v4.0.5 R18123!
minPathSize float 0.0 Ignoreed since v4.0.5 R18123!
inset float 0.0 Shrinks the area enclosed by the clipping path by the specified amount in points.

The parameter is not applied by comet_pdf.
#include "internal/types.h"
Learn more about clip path usage at  this example

17. March 2006 (P/R38)

priint:comet InDesign® Plug-Ins, comet_pdf

frame::image

static int setclip2(
  ItemRef frameRef = 0,
  int pathindex = 0,
  char* pathname = 0,
  int flags = 4,
  int clipToFrame = 0,
  float tolerance = 0.0,
  float minPathSize = 0.0,
  float Inset = 0.0)

Apply a clipping path. The clipping path must be defined inside the image.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef 0 Valid frame reference

0 : current script frame
pathindex int kIgnoreClipping 0-based index of clipping path

kIgnoreClipping : Ignore clip setting

kResetClipping : Reset any existing clipping..

kDefaultClipIndex : Use the default clipping path. comet_pdf uses the index 0 in this case.

>= 0 : 0-based clipping path index
pathname String or char* "" Name of clipping path

Ignored in case of pathindex >= 0.
flags int kAllowHolesFlag How to clip the image? Values can be added.

kInvertFlag : Invert the resulting path by combining with a path equal to the bounds of the image.

kAllowHolesFlag : Ingored since v4.0.5 R18123!

kRestrictToFrameFlag : Ingored since v4.0.5 R18123!

Value is ignored by comet_pdf.
cliptoFrame int 0 Use the the clipping path as to be the frames path?

0 : Keep old frame
1 : Use clip path as frame
tolerance float 0.0 Ignoreed since v4.0.5 R18123!
minPathSize float 0.0 Ignoreed since v4.0.5 R18123!
inset float 0.0 Shrinks the area enclosed by the clipping path by the specified amount in points.

The parameter is not applied by comet_pdf.
#include "internal/types.h"
Learn more about clip path usage at  this example

10. Jun 2016 R 11600

priint:comet InDesign® Plug-Ins, comet_pdf

frame::image

static int count_alpha_channels(ItemRef frameRef = 0)

Get the number of alpha channels of the image currently used by a frame.

Name Type Default Description
Return int   Number of alpha channels in the current image of a frame or 0
frameRef ItemRef 0 Valid frame reference

0 : current script frame
int main ()
{
    int			i;
    char		alpha	[256];
for (i = 0; i < image::count_alpha_channels (gFrame); i++) { wlog ("", " Channel %d : '%s'\n",   i,   image::alpha_channel_name (gFrame, i)); }
wlog ("", "(Pre) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
image::set_alpha_channel (gFrame, 2, 4, 0, 0.0, 0.0, 0.0, 12);
wlog ("", "(Post) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
return 0; }

v3.4 R5012, 26.11.2013

priint:comet InDesign® Plug-Ins

alpha_channel_name
alpha_channel_index
set_alpha_channel

static char* alpha_channel_name(ItemRef frameRef = 0, int nth = 0)

Get the Name of n-th alpha channel of the image currently set in the frame.

Name Type Default Description
Return char*   Name of n-th alpha channel of the image currently set in the frame. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

frameRef ItemRef 0 Valid frame reference

0 : current script frame
nth int 0 0-based index of alpha channel of interest.
int main ()
{
    int			i;
    char		alpha	[256];
for (i = 0; i < image::count_alpha_channels (gFrame); i++) { wlog ("", " Channel %d : '%s'\n",   i,   image::alpha_channel_name (gFrame, i)); }
wlog ("", "(Pre) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
image::set_alpha_channel (gFrame, 2, 4, 0, 0.0, 0.0, 0.0, 12);
wlog ("", "(Post) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
return 0; }

v3.4 R5012, 26.11.2013

priint:comet InDesign® Plug-Ins

count_alpha_channels
alpha_channel_index
set_alpha_channel

static int alpha_channel_index(ItemRef frameRef, char* name)

Get the index of a given alpha channel inside the image of a frame.

Name Type Default Description
Return int   index of a given alpha channel inside the image of a frame

-1 : Channel not found
frameRef ItemRef - Valid frame reference

0 : current script frame
name String or char* - Name of channel.
int main ()
{
    int			i;
    char		alpha	[256];
for (i = 0; i < image::count_alpha_channels (gFrame); i++) { wlog ("", " Channel %d : '%s'\n",   i,   image::alpha_channel_name (gFrame, i)); }
wlog ("", "(Pre) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
image::set_alpha_channel (gFrame, 2, 4, 0, 0.0, 0.0, 0.0, 12);
wlog ("", "(Post) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
return 0; }

v3.4 R5012, 26.11.2013

priint:comet InDesign® Plug-Ins

count_alpha_channels
alpha_pathname
set_alpha_channel

static int alphaindex(ItemRef frameRef = 0)

Get the index of the currently used alpha channel of a frame.

Name Type Default Description
Return int   0-based index of the currently used alpha channel of the frame

-1 : No alpha channel applied or error
frameRef ItemRef - Valid frame reference

0 : current script frame
int main ()
{
    int			i;
    char		alpha	[256];
for (i = 0; i < image::count_alpha_channels (gFrame); i++) { wlog ("", " Channel %d : '%s'\n",   i,   image::alpha_channel_name (gFrame, i)); }
wlog ("", "(Pre) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
image::set_alpha_channel (gFrame, 2, 4, 0, 0.0, 0.0, 0.0, 12);
wlog ("", "(Post) Current alpha channel : %d (%s)\n",   image::alphaindex (gFrame),   image::alpha_channel_name (gFrame, image::alphaindex (gFrame)));
return 0; }

v3.4 R5012, 26.11.2013

priint:comet InDesign® Plug-Ins

count_alpha_channels
alpha_pathname
set_alpha_channel

static int set_alpha_channel(
  ItemRef frameRef = 0,
  int index = 0,
  int flags = 4,
  int clipToFrame = 0,
  float tolerance = 0.0,
  float minPathSize = 0.0,
  float Inset = 0.0,
  int treshold = 255)

Apply an alpha channel.

Using comet_pdf even path indexes > 0 are intented to use the first alpha channel of the image. All following parameters of the function are ignored.

To use other alpha channel in comet_pdf too, please use setalpha2.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef - Valid frame reference

0 : current script frame
index int 0 0-based indexof clip path, see alpha_channel_index

kResetClipping do not apply any alpha channel

>= 0 : 0-based path index
flags int kAllowHolesFlag How to clip the image? Values can be added.

kInvertFlag Invert the resulting path by combining with a path equal to the bounds of the image.

kAllowHolesFlag For edge detection, do we remove the holes or leave them in.

kRestrictToFrameFlag

Value is ignored by comet_pdf.
cliptoFrame int 0 Use the the alpha channel as to be the frames path?

0 : Keep old frame
1 : Change frame
tolerance float 0.0 A tolerance value in the range of 0.0 to 10.0 specifying how close to the original path we must be if we smooth the path. 0.0 indicates a perfect match. Smoothing may simplify the path, reducing the number of points.

The parameter is not applied by comet_pdf.
minPathSize float 0.0 subpaths smaller than the minPathSize will be deleted.

The parameter is not applied by Indesign® Server and comet_pdf.
inset float 0.0 How far to inset the path

The parameter is not applied by comet_pdf.
treshold int 255 Treshold for alpha channel in the range of 0-255.

The parameter is not applied by comet_pdf.
#include "internal/types.h"
Learn more about clip path usage at  this example

v3.3 R3500, 8 Mar 2013

priint:comet InDesign® Plug-Ins, comet_pdf

frame::image

static int setalpha2(
  ItemRef frameRef = 0,
  int pathindex = 0,
  char* pathname = 0,
  int flags = 4,
  int clipToFrame = 0,
  float tolerance = 0.0,
  float minPathSize = 0.0,
  float Inset = 0.0,
  int treshold = 255)

Apply an alpha channel.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef - Valid frame reference

0 : current script frame
pathindex int 0 0-based index of channel, see alpha_channel_index

kResetClipping do not apply any alpha channel

>= 0 : 0-based channel index. Values > 0 are ignored by comet_pdf here. Comet_pdf uses the path defined by pathname instead.
pathname String or char* "" Name of alpha channel

Values ignored by InDesign® if the channel is defined by its index already.

Using InDesign® Server or comet_pdf this value is ignored!
flags int kAllowHolesFlag How to clip the image? Values can be added.

kInvertFlag Invert the resulting path by combining with a path equal to the bounds of the image.

kAllowHolesFlag For edge detection, do we remove the holes or leave them in.

kRestrictToFrameFlag

Value is ignored by comet_pdf.
cliptoFrame int 0 Use the the alpha channel as to be the frames path?

0 : Keep old frame
1 : Change frame
tolerance float 0.0 A tolerance value in the range of 0.0 to 10.0 specifying how close to the original path we must be if we smooth the path. 0.0 indicates a perfect match. Smoothing may simplify the path, reducing the number of points.

The parameter is not applied by comet_pdf.
minPathSize float 0.0 subpaths smaller than the minPathSize will be deleted.

The parameter is not applied by Indesign® Server and comet_pdf.
inset float 0.0 How far to inset the path

The parameter is not applied by comet_pdf.
treshold int 255 Treshold for alpha channel in the range of 0-255.

The parameter is not applied by comet_pdf.
#include "internal/types.h"
Learn more about clip path usage at  this example

v3.3 R3500, 8 Mar 2013

priint:comet InDesign® Plug-Ins, comet_pdf

frame::image

static int count_layers(ItemRef frameRef = 0)

Count layers of an image.

Name Type Default Description
Return int   Number of layers of a given image. Seperator-, section divider- andadjustment layers are counted too.
frameRef ItemRef 0 Valid frame reference

0 : current script frame
int main ()
{
    int			cl	= image::count_layers (gFrame);
    int			i;
    int			orgvis, curvis;
    char		lname [512];
if (cl == 0) { wlog ("", "# No layers found\n"); return 0; }
for (i = 0; i < cl; i++) { strcpy (lname, image::layername (gFrame, i, &orgvis, &curvis)); wlog ("", "# Layer %d : (%d, %d) '%s'\n",   image::layerindex (gFrame, lname),   orgvis,   curvis,   lname); }
image::show_layer (gFrame, "Maße RU"); return 0; }

Version 3.1 R1849, 5.5.2010

priint:comet InDesign® Plug-Ins

layername
layerindex
show_layers
hide_layers

static char* layername(
  ItemRef frameRef,
  int index,
  int* orgVis = 0,
  int* curVis = 0)

Get the name of an image layer given by its index.

Name Type Default Description
Return char*   Name of image layer or empty.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

frameRef ItemRef - Valid frame reference

0 : current script frame
index int - 0-based layer index
orgVis int* 0 Current layer visibility

0 : hidden
1 : visible
2 : unknown
orgVis int* 0 Layer visibility in image

0 : hidden
1 : visible
2 : unknown
int main ()
{
    int			cl	= image::count_layers (gFrame);
    int			i;
    int			orgvis, curvis;
    char		lname [512];
if (cl == 0) { wlog ("", "# No layers found\n"); return 0; }
for (i = 0; i < cl; i++) { strcpy (lname, image::layername (gFrame, i, &orgvis, &curvis)); wlog ("", "# Layer %d : (%d, %d) '%s'\n",   image::layerindex (gFrame, lname),   orgvis,   curvis,   lname); }
image::show_layer (gFrame, "Maße RU"); return 0; }

Version 3.1 R1849, 5.5.2010

priint:comet InDesign® Plug-Ins

count_layers
layerindex
show_layers
hide_layers

static int layerindex(
  ItemRef frameRef,
  char* name,
  int* orgVis = 0,
  int* curVis = 0)

Get the index of an image layer given by its name.

Name Type Default Description
Return int   0-based layer index or -1
frameRef ItemRef - Valid frame reference

0 : current script frame
name String or char* - Name of layer
orgVis int* 0 Current layer visibility

0 : hidden
1 : visible
2 : unknown
orgVis int* 0 Layer visibility in image

0 : hidden
1 : visible
2 : unknown
int main ()
{
    int			cl	= image::count_layers (gFrame);
    int			i;
    int			orgvis, curvis;
    char		lname [512];
if (cl == 0) { wlog ("", "# No layers found\n"); return 0; }
for (i = 0; i < cl; i++) { strcpy (lname, image::layername (gFrame, i, &orgvis, &curvis)); wlog ("", "# Layer %d : (%d, %d) '%s'\n",   image::layerindex (gFrame, lname),   orgvis,   curvis,   lname); }
image::show_layer (gFrame, "Maße RU"); return 0; }

Version 3.1 R1849, 5.5.2010

priint:comet InDesign® Plug-Ins

count_layers
layername
show_layers
hide_layers

static int show_layer(
  ItemRef frameRef,
  char* layerName,
  int doShow = 1)

Change the visibility of an image layer.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef 0 Valid frame reference

0 : current script frame
layerName String or char* 0 Name of layer. If empty (0 or "") the original state for all layers is recovered.
doShow int 1 Visibility

1 : Show
0 : Hide

If layerName is empty, this parameter is ignored.
int main ()
{
    int			cl	= image::count_layers (gFrame);
    int			i;
    int			orgvis, curvis;
    char		lname [512];
if (cl == 0) { wlog ("", "# No layers found\n"); return 0; }
for (i = 0; i < cl; i++) { strcpy (lname, image::layername (gFrame, i, &orgvis, &curvis)); wlog ("", "# Layer %d : (%d, %d) '%s'\n",   image::layerindex (gFrame, lname),   orgvis,   curvis,   lname); }
image::show_layer (gFrame, "Maße RU"); return 0; }

Version 3.1 R1849, 5.5.2010

priint:comet InDesign® Plug-Ins

count_layers
layerindex
layername
hide_layers

static int barcode(
  ItemRef gFrame,
  char* text,
  char* type,
  int width = 144,
  int height = 92,
  int xoff = 10,
  int yoff = 10,
  ...)

Create a machine-readable code (Barcode, EAN, QR-Code, ...). The image of the code is created as an embedded Postscript image, no additional files are created.

Attention: InDesign changes directly embedded Posctscript images while exporting an re-importing the document using IDML:

  1. Embedded Postscript images are converted into pixel images automatically. And, in addition, the new image is embedded into a new frame. Only the new created frame is inserted (as a sub-frame) into the original frame.
  2. Pixel images may have different sizes than their originals.
  3. Pixel images will get an (unknown) resolution.
If you wish to use IDML-versions of your documents, you have created the barcodes IDML-save. See parameters filetype and filepath how to do this.

The function is a nice to have and is NOT subject of any support by WERK II!

Please check the codes for validity before using them. Wrong codes can cause InDesign® to crash! No validations checks are performed of the barcodes. Only EAN-13 are checked for validity (from v4.1.6 R25001).

The function is based on "Barcode Writer in Pure PostScript" by Terry Burton with the following legal notes:

Barcode Writer in Pure PostScript http:bwipp.terryburton.co.uk

Copyright (c) 2004-2014 Terry Burton

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef - Valid frame reference

0 : current script frame
text String or char* - Text to code. See here for examples of exoctic codes.
type String or char* - Type of code to create, See row type of table of available codes.. If you plan to create QRCodes, please read the additional notes for QRCodes.
width, height int, int 144, 92 Size of output area (canvas). The generated code is placed at the bottom left of this area. Too small values can cut off the code at the top and right, values that are too large create white space.

The number of modules (the small squares of the code) depends on the length of the coded text. You can find more information here:

xoff, yoff int, int 10, 10 Offset of the code itself to the lower left corner of the canvas.
... ... empty Optional parameters as key/value pairs:

"options", "..."

Layout rules to create the code, see here for a complete list of available options. Additional code specific options you will find near the code descriptions..

The list is preassigned by the word "includetext". If you wish to suppress texts beside the code, please add the key suppresstext to your options.

One option value may contain any (blank-delimited) number of values you want. And you may define any number of option keys to - its values are (again blank-delimited) simply added to the current list of options.

"filetype", "..."

Not for comet_pdf. IDML-save embeding of barcode. Following values are supported:

"ps" : The link to the image file is embeded into the frame rather then its content. After that, the Postscript file is removed, but the "Embedded" entry inside the Link panel still remains.

"jpg", "tif", "gif" : The content of the image file is embeded directly into the frame. No new entries will appear in the Link panel but of course, the image now has a fix resolution (That is taken from the option resolution).

"filepath", "..."

Not for comet_pdf. Complete path to an output file. The code is written to the given path and the image is then linked to the given frame. If an image resolution is needed, it is taken from the option resolution. The following image formats are supported:

  "ps", "jpg", "tif", "gif"

"resolution", float

Not for comet_pdf Resolution for GIF/TIF/JPG images, ignored in case of Postscript.

Create orange QR codes of URLs not longer than 100 letters with an error correction of 7% and a unique size (74 = 2 * (17 + 5 * 4)):

image::barcode (gFrame,
    "your URL", "qrcode",
    74, 74, 0, 0,
    "options", "version=5 eclevel=L barcolor=FF8800",
    "filetype", "ps");

Snd this is an EAN 13 without text label:

image::barcode (gFrame,
    "9771473968012", "ean13",
    144, 92, 0, 0,
    "options", "suppresstext",
    "filetype", "ps");

The following codes are supported:
Code name (type) Example
EAN-5 ean5 90200
EAN-8 ean8 01335583
EAN-8 Composite ean8composite 12345670|(21)A12345678
EAN-13 ean13 9771473968012
EAN-13 Composite ean13composite 331234567890|(99)1234-abcd
EAN-2 ean2 05
QR Code. Here you will find additional information about QR codes.. qrcode Irgendwas
Data Matrix datamatrix This is Data Matrix!
MaxiCode maxicode [\)>^03001^02996152382802¬
^029840^029001^0291Z00004951¬
^029UPSN^02906X610^029159¬
^0291234567^0291/1^029^029Y¬
^029634 ALPHA DR¬
^029PITTSBURGH^029PA^029^004
Aztec Code azteccode This is Aztec Code
UPC-A upca 78858101497
UPC-A Composite upcacomposite 01600033610|(99)1234-abcd
UPC-E upce 0123456
UPC-E Composite upcecomposite 0121230|(15)021231
ISBN isbn 978-1-56592-4796 54495
ISMN ismn 979-0-2600-0043
ISSN issn 0317-8471 00 05
Code One codeone Das ist eine Nachricht!
Code 16K code16k Abcd-1234567890-wxyZ
Code 39 code39 THIS IS CODE 39
Code 39 Extended code39ext Code39 Ext!
Code 128 code128 Count01234567^FNC2!
Code 49 code49 MULTIPLE ROWS IN CODE 49
GS1-14 ean14 (01)04601234567893
GS1 Composite 2D Component gs1-cc (01)95012345678903(3103)000123
GS1 Data Matrix gs1datamatrix (01)03453120000011(17)120508(10)¬
ABCD1234(410)9501101020917
GS1-128 gs1-128 (01)95012345678903(3103)000123
GS1-128 Composite gs1-128composite (00)030123456789012340|(02)130¬
12345678909(37)24¬
(10)1234567ABCDEFG
GS1 DataBar Omnidirectional databaromni (01)24012345678905
GS1 DataBar Omnidirectional Composite databaromnicomposite (01)03612345678904|(11)990102
GS1 DataBar Stacked databarstacked (01)24012345678905
GS1 DataBar Stacked Composite databarstackedcomposite (01)03412345678900|(17)010200
GS1 DataBar Stacked Omnidirectional databarstackedomni (01)24012345678905
GS1 DataBar Stacked Omnidirectional Composite databarstackedomnicomposite (01)03612345678904|(11)990102
GS1 DataBar Truncated databartruncated (01)24012345678905
GS1 DataBar Truncated Composite databartruncatedcomposite (01)03612345678904|(11)990102
GS1 DataBar Limited databarlimited (01)15012345678907
GS1 DataBar Limited Composite databarlimitedcomposite (01)03512345678907|(21)abcdefghijklmnopqrstuv
GS1 DataBar Expanded databarexpanded (01)95012345678903(3103)000123
GS1 DataBar Expanded Composite databarexpandedcomposite (01)93712345678904(3103)¬
001234|(91)1A2B3C4D5E
GS1 DataBar Expanded Stacked databarexpandedstacked (01)95012345678903(3103)000123
GS1 DataBar Expanded Stacked Composite databarexpandedstackedcomposite (01)00012345678905(10)¬
ABCDEF|(21)12345678
SSCC-18 sscc18 (00)006141411234567890
Italian PharmaCode code32 01234567
Pharmazentralnummer pzn 123456
Interleaved 2 of 5 (ITF) interleaved2of5 2401234567
ITF-14 itf14 04601234567893
Pharmaceutical Binary Code pharmacode 117480
Two-track Pharmacode pharmacode2 117480
Code 25 code2of5 01234567
Code 11 code11 0123456789
BC412 bc412 BC412
Rationalized Codabar rationalizedCodabar A0123456789B
Deutsche Post Identcode identcode 563102430313
Deutsche Post Leitcode leitcode 21348075016401
United States Postal Service Intelligent Mail onecode 0123456709498765432101234567891
United States Postal Service POSTNET postnet 01234
United States Postal Service PLANET planet 01234567890
Royal Mail 4 State Customer Code (RM4SCC) royalmail LE28HS9Z
AusPost 4 State Customer Code auspost 5956439111ABA 9
Royal Dutch TPG Post KIX 4-State Barcode kix 1231FZ13XHS
Japan Post 4 State Customer Code japanpost 6540123789-A-K-Z
MSI Modified Plessey msi 0123456789
Plessey UK plessey 01234ABCD
Telepen telepen 123456
PosiCode posicode ABC123
Codablock F codablockf CODABLOCK F 34567890¬
123456789010040digit
Channel Code channelcode 3493
Flattermarken flattermarken 12345
Raw bar space succession for custom symbologies raw 331132131313411122¬
131311333213114131131221323
Raw DAFT succession for custom 4 state symbologies daft FATDAFTDAD
Miscellaneous symbols symbol fima
PDF417 pdf417 This is PDF417
MicroPDF417 micropdf417 MicroPDF417
HIBC Code 39 hibccode39 A123BJC5D6E71
HIBC Code 128 hibccode128 A123BJC5D6E71
HIBC Data Matrix hibcdatamatrix A123BJC5D6E71
HIBC PDF417 hibcpdf417 A123BJC5D6E71
HIBC MicroPDF417 hibcmicropdf417 A123BJC5D6E71
HIBC QR Code hibcqrcode A123BJC5D6E71
HIBC Codablock F hibccodablockf A123BJC5D6E71

QR codes getting bigger the more data they contain. Strings up to 2953 bytes (not letters!) are encodeable. To get a unique size of QR codes, QR codes may have a Version) in the range of 1-40. QR codes of the same version having the same size always. To calculate the size in modules use the following formula:

Size of square = 17 + (Version * 4) modules

The modules created by image::barcode are 2 pts wide by default, so a version 1 QR code is 42 pts wide.

QR codes may have an error correction, see parameter eclevel. Error correction may reduce the number of bytes to encode. See the following tables for the maximum number of bytes to encode:
Error correction Low, 7% Loss recovery possible
Version Max. bytes
1-10 17, 32, 53, 78, 106, 134, 154, 192, 230, 271
11-20 321, 367, 425, 458, 520, 586, 644, 718, 792, 858
21-30 929, 1003, 1091, 1171, 1273, 1367, 1465, 1528, 1628, 1732
31-40 1840, 1952, 2068, 2188, 2303, 2431, 2563, 2699, 2809, 2953
Error correction Medium, 15% Loss recovery possible
Version Max. bytes
1-10 14, 26, 42, 62, 84, 106, 122, 152, 180, 213
11-20 251, 287, 331, 362, 412, 450, 504, 560, 624, 666
21-30 711, 779, 857, 911, 997, 1059, 1125, 1190, 1264, 1370
31-40 1452, 1538, 1628, 1722, 1809, 1911, 1989, 2099, 2213, 2331
Error correction High, 20% Loss recovery possible
Version Max. bytes
1-10 11, 20, 32, 46, 60, 74, 86, 108, 130, 151,
11-20 177, 203, 241, 258, 292, 322, 364, 394, 442, 482
21-30 509, 565, 611, 661, 715, 751, 805, 868, 908, 982
31-40 1030, 1112, 1168, 1228, 1283, 1351, 1423, 1499, 1579, 1663
Error correction Quality, 30% Loss recovery possible
Version Max. bytes
1-10 7, 14, 24, 34, 44, 58, 64, 84, 98, 119
11-20 137, 155, 177, 194, 220, 250, 280, 310, 338, 382
21-30 403, 439, 461, 511, 535, 593, 625, 658, 698, 742
31-40 790, 842, 898, 958, 983, 1051, 1093, 1139, 1219, 1273

v3.3 R2688, 28.10.2011
Schlüssel "options", "filetype", "filepath" and "resoltion" since v4.0.5 R11812, 21. Jun 2016

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.CFrame.setBarcode

static int qrcode(
  ItemRef gFrame,
  int type,
  ItemRef colorRef,
  char* content1,
  char* content2 = 0,
  char* content3 = 0,
  char* content4 = 0,
  char* content5 = 0,
  char* content6 = 0,
  char* content7 = 0,
  char* content8 = 0,
  char* content9 = 0,
  char* content10 = 0,
  char* content11 = 0,
  char* content12 = 0,
  char* content13 = 0)

Create a QR code. The instruction corresponds to the menu Object -> Generate QR Code.... Additionally, differently than in the menu command, a changed QR code can be adapted to the frame size.

Name Type Default Description
Return int   0 or ErrorCode
frameRef ItemRef - Valid frame reference

0 : Current script frame
type int - Type of the QR Code. With negative values the generated code is adjusted and centred in the frame.

±kQRCodeText = 1 : Text
±kQRCodeEmail = 2 : EMail
±kQRCodeHyperlink = 3 : Hyperlink
±kQRCodeSMS = 4 : SMS
±kQRCodeVCard = 5 : Business card
colorRef ItemRef - Color of the QR Code

0 : Black
otherwisxe : Valid swatch reference from color::define et al.
content1-13 char* or String 0 Text content of the QR Code. The first content string must not be empty! The number of strings required depends on the type of QR code.

kQRCodeText
   content1 Text of code

kQRCodeEmail
   content1 EMail
   content2 Subject
   content3 Body

kQRCodeHyperlink
   content1 Hyperlink

kQRCodeSMS
   content1 Telephon number
   content2 Message

kQRCodeVCard
   content1 First name
   content2 Last name
   content3 Title
   content4 Telephon number
   content5 Cell number
   content6 E-Mail
   content7 URL
   content8 Organization
   content9 Address
   content10 City
   content11 State
   content12 Zip code
   content13 Country
#include "internal/types.h"
#include "internal/type.h"
int main () { ItemRef orange = item::alloc (); String firstname = string::alloc (); String lastname = string::alloc (); String country = string::alloc (); String zip = string::alloc (); String city = string::alloc (); String vcard;
color::define_rgb ("Orange", 255, 128, 10, 1, orange); image::qrcode (gFrame, -kQRCodeVCard, orange,   "Paul", // First name   "Seidel", // Last name   0, // Job title   0, // Tel no   0, // Cell no   "paul@priint.com", // email   "priint.com", // web site   "WERK II GmbH", // organization   "Ruth-Marx-Str. 9", // street   "Tübingen", // city   "Baden-Württemberg", // state   "72072", // zip   "D"); // country
wlog ("", "# Type : %d\n", image::qrcode_gettype (gFrame)); vcard = image::qrcode_getcontent (gFrame,   firstname,   lastname,   0,   0,   0,   0,   0,   0,   0,   city,   0,   zip,   country);
wlog ("", "# %s %s : %s-%s %s\n", firstname, lastname, country, zip, string::upper (city)); wlog ("", "# %s\n", vcard);
return 0; }

v4.1.8 R27646, 20. Oct. 2020

priint:comet InDesign® Plug-Ins

qrcode_gettype
qrcode_getcontent
frame::is_qrcode

static int qrcode_gettype(ItemRef gFrame)

Type of a QR code. Determine the type of a QR Code.

Name Type Default Description
Return int   Type of QR Code

0 : No QR code or error

1 (kQRCodeText) : Text
2 (kQRCodeEmail) : EMail
3 (kQRCodeHyperlink) : Hyperlink
4 (kQRCodeSMS) : SMS
5 (kQRCodeVCard) : Business card
frameRef ItemRef - Valid frame reference

0 : Current script frame
#include "internal/types.h"

v4.1.8 R27646, 20. Oct. 2020

priint:comet InDesign® Plug-Ins

qrcode
qrcode_getcontent
frame::is_qrcode

static char* qrcode_getcontent(
  ItemRef gFrame,
  char* content1 = 0,
  char* content2 = 0,
  char* content3 = 0,
  char* content4 = 0,
  char* content5 = 0,
  char* content6 = 0,
  char* content7 = 0,
  char* content8 = 0,
  char* content9 = 0,
  char* content10 = 0,
  char* content11 = 0,
  char* content12 = 0,
  char* content13 = 0)

Text content of a QR Code. Determine the text encoded by the QR code.

Name Type Default Description
Return char*   Entire text content of the QR Code.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

frameRef ItemRef - Valid frame reference

0 : Current script frame
content1-13 char* or String 0 Text parts of the QR Code. The return values depend on the type of the QR Code.

kQRCodeText
   content1 Text of code

kQRCodeEmail
   content1 EMail
   content2 Subject
   content3 Body

kQRCodeHyperlink
   content1 Hyperlink

kQRCodeSMS
   content1 Telephon number
   content2 Message

kQRCodeVCard
   content1 First name
   content2 Last name
   content3 Title
   content4 Telephon number
   content5 Cell number
   content6 E-Mail
   content7 URL
   content8 Organization
   content9 Address
   content10 City
   content11 State
   content12 Zip code
   content13 Country
#include "internal/types.h"
#include "internal/type.h"
int main () { ItemRef orange = item::alloc (); String firstname = string::alloc (); String lastname = string::alloc (); String country = string::alloc (); String zip = string::alloc (); String city = string::alloc (); String vcard;
color::define_rgb ("Orange", 255, 128, 10, 1, orange); image::qrcode (gFrame, -kQRCodeVCard, orange,   "Paul", // First name   "Seidel", // Last name   0, // Job title   0, // Tel no   0, // Cell no   "paul@priint.com", // email   "priint.com", // web site   "WERK II GmbH", // organization   "Ruth-Marx-Str. 9", // street   "Tübingen", // city   "Baden-Württemberg", // state   "72072", // zip   "D"); // country
wlog ("", "# Type : %d\n", image::qrcode_gettype (gFrame)); vcard = image::qrcode_getcontent (gFrame,   firstname,   lastname,   0,   0,   0,   0,   0,   0,   0,   city,   0,   zip,   country);
wlog ("", "# %s %s : %s-%s %s\n", firstname, lastname, country, zip, string::upper (city)); wlog ("", "# %s\n", vcard);
return 0; }

v4.1.8 R27646, 20. Oct. 2020

priint:comet InDesign® Plug-Ins

qrcode
qrcode_getcontent
frame::is_qrcode

Preconditions
#include "internal/types.h"

The example demonstrates the handling of clipping paths

#include "internal/types.h"
int showpaths (ItemRef frameRef) { int count = image::count_paths (gFrame); int i;
showmessage ("Available paths %d", count); for (i = 0; i < count; i++) { showmessage ("%d. %s", i, image::pathname (gFrame, i)); }
return 0; }
int main () { int index = image::clipindex (gFrame); int count = image::count_paths (gFrame); int err;
// show available paths if (count <= 0) return 0; else showpaths (gFrame);
// show current clip path if (index < 0) { index = -1; showmessage ("no clip path"); } else showmessage ("Current path %d : %s",   index+1,   image::pathname (gFrame, index));
// set new clip path if (index == count -1) index = -1; else index = (index + 1) % count; err = image::setclip (   gFrame,   index,   kAllowHolesFlag,   0, 0.0, 0.0); if (err) showerror ("setclip error : %d", err);
return 0; }

Author
Paul Seidel
Version
16.10.2024, 11:40 Uhr
Since
Plugin Version 1.0.10

Alphabetic index HTML hierarchy of classes or Java