Based on Simple way to add an image in postscript I wrote the following:
gsave
360 72 translate % set lower left of image at (360, 72)
230 346 scale % size of rendered image is 175 points by 47 points
2304 % number of columns per row
3456 % number of rows
8 % bits per color channel (1, 2, 4, or 8)
[2304 0 0 -3456 0 3456] % transform array... maps unit square to pixel
(graphics/IMG_2216.jpg) (r) file /DCTDecode filter % opens the file and filters the image data
false % pull channels from separate sources
3 % 3 color channels (RGB)
colorimage
grestore
but this gives:
Error: /invalidfileaccess in --file-- Operand stack: 2304 3456 8 --nostringval-- (graphics/IMG_2216.jpg) (r) Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1894 1 3 %oparray_pop 1893 1 3 %oparray_pop --nostringval-- 1877 1 3 %oparray_pop 1771 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1166/1684(ro)(G)-- --dict:0/20(G)-- --dict:126/200(L)-- --dict:136/228(L)-- Current allocation mode is local
What is going wrong here?
Quite simply there is a problem accessing the file. Either the file does not exist in the specified location, or you do not have access rights to it.
Given that you are opening the file for read, the most likely is that the file doesn't exist. I notice that you haven't used a fully qualified path, perhaps you are executing the PostScript from the wrong location.