Converting a visio to a JPG image - image

I have a .vss type file which I want to convert to an image format (like JPG/GIF). Is it possible to do this and if so, how?

Not programming related and you can simply use "File > Save as..." to save as a JPG.

Related

Rust open image with other format than file extension

I am trying to open an image in my Rust program. The image is named foo.png, but it won't open the image with image::open("foo.png").
If I rename the file to foo.jpeg, I can open the image, so my guess is that the formatting and the file extension do not match.
My question is then. how do I open a file named foo.png, but decode it as a jpeg?
I have tried image::io::Reader, but I can't seem to make it work properly.
You can use the image::load() function, which lets you specify the format:
let image = image::load(BufReader::new(File::open("foo.png")?), ImageFormat::Jpeg)?;

Cannot open PNGs created with canvas.toDataUrl

I create a png blob from a canvas with the toDataUrl method.
const pngdata = canvas.toDataURL("image/png");
I open a text editor and copy the content of pngdata into a file that I call img.png
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkMAAAiICAYAAAD...
I save this file. When I try to open it (Windows 10) I get "It looks like we don't support this file format"
Removing data:image/png;base64, from the file doesnt help
Why does this not work?
Because your file is still encoded as Base64. You need to decode it to actual binary data for it to be a correct binary file.
You can find many online tools that will do this for you, or the best is probably to directly export your canvas drawing to a binary Blob and download this Blob thanks to a blob:// URL.

Ghostscript Stamp Image on PDF

Is there any way to stamp or overlap a tiff image on a existing PDF file and output the result using Ghostscript?
I have two PDF which i want to merge in a result PDF with one over the other using ghostscript. I want to know if this can be done and how, or if it may work with one PDF as tiff image on top of the base PDF.
Can ghostscript make this stamp using layers in the PDF?
Thank you for your answers
The pdfwrite device in Ghostscript doesn't really support layers, so you can't use that. Also its unclear why you think layers would help.
TIFF isn't part of PostScript (or PDF), so you can't directly read a TIFF file into GS. I have elsewhere posted a PostScript program which reads TIFF files and renders them for output. You could use that to read a TIFF file.
However, you would have to mess about with either the PDF interpreter or a custom EndPage procedure in order to read and render the TIFF file. And unless you take specific kinds of action, it will be opaque, which may well not be what you want.
The Ghostscript PDF interpreter doesn't really lend itself to this kind of manipulation, have you considered using pdftk instead ?

How to modify a .png image with VBScript

I have a need to select a portion of a .png file, with specific cordinators, and delete this area then save the file back with the same name.
I would appreciate if you can help to come up with a VBScript script that can accomplish this task.
It would be great if all proesses happen in the background, but it would be ok too if the image file has to be open and visible. Thanks a bunch!!!
A PNG file, like any other binary file can be edited with CMD or VBS.
A PNG file layout is as follows:
File header
"Chunks" within the file
Pixel format
Transparency of image
Compression
Interlacing
Animation
Read the PNG format in RFC 2083 to know how to edit/create a PNG file at binary/bit level.
To speed up the editing process, libraries are available for application level editing.
Here are some VBA codes for image manipulation.
ImageMagick also provides libraries that can be accessed via VBS for image editing.
Here's a VBScript Image Class for bmp and pcx files (which PNG can be converted to before editing via WIA).
Loadpicture function described here doesn't seem to support PNG, but this discussion might solve it.
The Windows Image Acquisition Library v2.0 supports PNG, BMP, JPG, GIF and TIFF image formats, and comes with Windows Vista and later versions. Sample scripts are available to demonstrate "image manipulation using the ImageFile object". The Vector.ImageFile property also "creates an ImageFile object from raw ARGB data".
More sample codes here & here show how to rotate, flip, scale, crop, etc with WIA Image constants in vbs. To remove unwanted areas of image (with given coordinates), use the crop function.
Here's a discussion of WIA 2.0 image editing on stackoverflow.
VBScript doesn't have any image editing functions, so you need an external tool for that. For example, GIMP can do image processing from the command line (see here). ImageMagick provides a scriptable component in addition to the command-line interface (details here).
To run a command line from a VBScript script, you can use the WShShell.Run method. To create an instance of a COM scriptable component, use the CreateObject function.

how to convert rtf to image format ( jpg/png..)

i need to convert rtf document that contains images (jpgs/pngs ) to image format
jpgs or pngs programmaticly , do you have any ideas on how to do it ?
on server side (web)
Thanks
You can use a virtual printing device, for example: http://www.joyprinter.com/
If by programmatically, you mean scripts, you could script your RTF program to open files, then export to PDF, then export the PDF to an image. At least, this kind of operation is relatively easy on OS X. You could probably do it entirely in Automator, using TextEdit and Preview. Otherwise, on OS X you could also try accessing the core services that would do the same thing. No clue on Windows though. Hope that helps!
You might want to write a bash script to be executed by a cronjob. So at a defined time, or after a defined period, you will have your rtf files converted into jpgs.
Though I don't know if this might satisfy your "programmatic" need .. here is how to do this conversion:
To convert rtf files contain "advanced" features like images, as in your case, you need unoconv, which requires libreoffice to be installed.
unoconv -f pdf "${input_file}"
Otherwise, just for reference because it's not your case, if the rtf files contain only simply text you can avoid the requirement to have libreoffice installed by using a cascade conversion like
// convert rtf to txt
unrtf --text "input_file.rtf" > "temp.txt"
// convert txt to pdf
enscript "temp.txt" -o - | ps2pdf - "temp.pdf"
// convert pdf to jpg
convert -quality 100 -append "temp.pdf" "output.jpg"
// remove temp files
trash "temp.txt" "temp.pdf" // or rm if you prefer

Resources