Put an image with transparent background into a pdf using Libharu - pdf

I have to put an image (.png) into a pdf file using LibHaru. The image has a transparent background due to which it looks quite awkward (black background) into the pdf file.
How can I put this image (with transparent background) properly using C++ LibHaru?

You need to split your PNG file into two images: one for color pixels and another one for opacity values. Then you need to add the color image into PDF with specifying the second as SMASK property.
See 4.8.4 Image Dictionaries in PDF specification for more details.
You can use HPDF_Image_AddSMask method for this.

Related

Smallest possible invisible PDF?

This question is related to What is the smallest possible valid PDF?, but goes one step further: I'd like a PDF file that is as small as possible, but also invisible.
That means:
it contains no text or other objects (or if that's not possible, only completely transparent ones), and
it has no background (or if that's not possible, a completely transparent background).
When I open this file in a compliant PDF viewer, the background color of the viewer panel should show through completely, and when I embed it in a document on top of other elements, only these other elements should show.
PDF pages have no background color by default (if you need an explicit background you have to draw a colored rectangle that covers the entire page).
PDF viewers will use a default white background to simulate a paper page, so the actual background depends on the PDF viewer.
When you place a PDF page on top of another one it will not block the underlying content if it does not have an explicit background.

Exporting Illustrator AI to SVG without a white background

I have a Illustrator CS5 AI file that has two shapes in it on a transparent background/artboard. However, when I save this file as a SVG file (1.1) using "Save as", the resulting SVG file has a white background.
How do I get rid of the white background in the SVG file?
The AI file can be found here:
http://hostsafe.com/temp/in.ai
The SVG file that I keep getting can be found here:
http://hostsafe.com/temp/in.svg
Exported svg does not contain white background, it is just another view mode (hidden transparency grid). To show the transparency grid again go to 'View->Show Transparency Grid' or press Shift+Ctrl+D.

fit multiple images on background image using imagemagick

I am trying to use image magic to do the following:
I have pdf with multiple pages, I want to convert them into JPG.
I have a background image with fixed width and height which will work as a container.
I want to place each of the converted JPGs alone on the background image and fit it on the background image with stretching and keeping the image proportion, so the background image will fill the empty space around it.
I want to save the result image as JPG in two different specific sizes.
How could I do that?

ImageJ add watermark

ImageJ: What is the best way to add watermark to image?
I use two images the original image and the watermark image. The problem (in watermark image)is that I cannot change the opacity of the text without changing the opacity of the background. Note: the background transparency is 100% if I did not change opacity of the text
My recommendation is to use this tool: http://www.paintshoppro.com/en/pages/watermark-photos/ to add watermark to your photos, because sometimes watermarks can make your photos safer, but they can also be very easily removed, so your back to where you started. if you do it with that tool and make a transparent watermark, it wouldn't disturb the concept of the photo, but would also be much harder to remove.

Remove white background from an image

I want to get a transparent background or no background for my images. I tried the '-background none' option and also the 'transparent' option, but the background image remains white. How can I achieve this?
Please suggest.
If you are using Imagemagik then the command is:
convert input.gif -transparent white output.gif
However, it will only work with a pure white background and not a shade of white.
There are alternative and easier ways to do this with IrfanView or The Gimp or Photoshop (more on that below).
This article mentions that you may be using convert.exe that comes with Windows rather than ImageMagicks Convert.exe in which case you should use the full path for Convert.exe.
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=10665
If you are trying to achieve this from CSS then you misunderstand the CSS property.
The css property 'background' refers to an html elements background color. I.e. <p> <div> <body> whatever.
more here http://www.w3schools.com/css/css_background.asp
If you are referring to the image opacity property, that refers to how "see-through" an image should be. more here:
http://www.w3schools.com/Css/css_image_transparency.asp
The only way to get a transparent background in an image is to make the background of the image transparent using either the PNG (preferred) or GIF formats. For this you can use IrfanView and save a picture as PNG, select the "save transparency" property and select the color from the image you want to be transparent or you can use Photoshop or The Gimp do the same. Example for IrfanView here http://llizard.etherwork.net/cwc/transp_irfanview.html
The Gimp example here http://aplawrence.com/Linux/crousegif.html
whats the format of your images? Try using png format