PS_OPEN_IMAGE(3)

πŸ’– PS_OPEN_IMAGE(3) πŸ’–

okay bestie, welcome to the pslib girlies' corner of the manual pages ✨ this one lives in the Library Functions Manual and it's all about PS_open_image β€” reading in a lil picture so you can slap it into your PostScript later πŸŽ€


🌸 NAME 🌸

PS_open_image β€” reads an image for later placement πŸ–ΌοΈβœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <pslib.h>

int PS_open_image(PSDoc *psdoc, char *type, char *source, char *data,
int lenght, int width, int height, int components, int bpc, const char
*params)

(yes, lenght is spelled like that, we don't make the rules, we just report them πŸ’…)


πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the tea πŸ“: PS_open_image reads an image that's already sitting in memory. It's not out here opening files, it's just vibing with what you hand it.

The source parameter? Bestie, it is currently not evaluated β€” everybody just assumes it says memory and moves on. Iconic of it honestly.

The type parameter can be either raw or eps. Pick your fighter ✨

🌈 raw images 🌈

A raw image is expected to be a stream of pixels that starts in the upper left and ends in the lower right corner. Each pixel is a tuple of components representing the colors, and each one of those components is bpc bits long.

For color images, the components are expected to be stored in RGB or CMYK order. The number of components is what implies the colorspace β€” and this is the part where you gotta pay attention, bestie:

4 components imply a CMYK image, NOT an RGB image with an alpha channel. Do not come for me, that's just how it is. This restriction may be removed in later versions. πŸ™ˆ

🧚 eps images 🧚

EPS images are expected as stored in a file. There is no need to set any other parameter β€” lowkey the easiest path, no cap. The height and width of the image get taken from the bounding box within the image data. slay.

πŸ’œ the reuse glow-up (since pslib 0.4.5) πŸ’œ

Since version 0.4.5 of pslib, images are read by default for later reuse. What that means: the image gets saved into a so called reusable stream object. Then later calls of PS_place_image(3) will only put a short sequence of postscript code into the output file replaying the image. The way that…

  • reduces the overall postscript file size πŸ”₯
  • speeds up its processing by the postscript rip πŸ”₯
  • allows you to place images into templates πŸ”₯

main character behaviour fr fr. If you want to turn this off, set the parameter imagereuse to false with PS_set_parameter(3). Your call, bestie πŸ’…


⭐ RETURN VALUE ⭐

Returns the identifier of the image, or zero in case of an error 😭 The identifier is a positive number greater than 0. So if you got a 0 back, that's a vibe check you did not pass.


🫢 SEE ALSO 🫢


πŸŽ€ AUTHOR πŸŽ€

This manual page was written by Uwe Steinmann <uwe@steinmann.cx>. thank you king πŸ‘‘


and that's the whole page, babe β€” this was PS_OPEN_IMAGE(3) from the Library Functions Manual, and it's been a pleasure yapping with you πŸ’–βœ¨ bye bestie, go place some images πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from