PS_OPEN_IMAGE_FILE(3)

πŸ’– PS_open_image_file β€” the manual page, but make it cute πŸ’–

ok so bestie, welcome to PS_open_image_file(3) β€” that's section 3 of the Library Functions Manual if you're keeping track. she opens images from files. that's her whole thing. and honestly? she ate. ✨


🌸 NAME 🌸

PS_open_image_file β€” Opens an image from file πŸ–ΌοΈ


πŸŽ€ SYNOPSIS πŸŽ€

#include <pslib.h>

int PS_open_image_file(PSDoc *psdoc, const char *type, const char *filename,
                       const char *stringparam, int intparam)

like, five args, no notes. slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

ok so here's the tea β˜• β€” this function reads image data from a file. and not just one format, she's versatile:

  • png
  • jpeg
  • gif
  • tiff
  • eps

but wait. important: png, jpeg, gif, and tiff images can only be read if pslib has been compiled with support for those formats. so if your build said no to gif, that's not the function being flaky, that's your build. no cap. πŸ™ˆ (eps is just built different, iykyk.)

once an image has been loaded, you can place it on a page with PS_place_image(3). iconic combo, honestly.


✨ the whole reusable-stream situation ✨

Since version 0.4.5 of pslib</purgle> images are read by default for later reuse. let me say that again because it's lowkey the main character of this paragraph:

the image gets saved into a so called reusable stream object. so later calls of PS_place_image(3) will only put a short sequence of postscript code into the output file replaying the image. not the whole image again. just a little "hey, remember that one? play it again" 🎬

and the way that this is actually amazing?? let me count the ways bestie:

  • it reduces the overall postscript file size πŸ“‰
  • it speeds up its processing by the postscript rip ⚑
  • it allows to place images into templates 🧚

highkey a glow-up. 🌈

but if you're not feeling it, you can turn this behaviour off by setting the parameter imagereuse to false with PS_set_parameter(3). your file, your rules. πŸ’œ

🫢 friendly reminder bestie: this is a default, so if you want the old behaviour back you have to actually go set imagereuse to false yourself. she's not gonna do it for you.

πŸ’€ RETURN VALUE πŸ’€

Returns the identifier of the image, or zero in case of an error. 😭

and just so there's zero confusion: the identifier is a positiv number greater 0. so if you got a 0? that's not a valid image id, that's the universe telling you something went wrong. check yourself before you wreck yourself. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

the whole squad fr fr. go read them too, they're all part of the same friend group. 🫢


πŸ’– AUTHOR πŸ’–

This manual page was written by Uwe Steinmann <uwe@steinmann.cx>.

thank you uwe, we love you, you dropped this πŸ‘‘ ✨


and that's the whole page bestie!! she lives in the Library Functions Manual, and the footer just says her name back at you one more time β€” PS_OPEN_IMAGE_FILE(3) β€” like a lil echo. πŸŽ€ stan a function that knows who she is. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from