FPDF error: Alpha channel not supported

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

FPDF error: Alpha channel not supported

Post by Albireo »

Hello!

I have created a number of images to be displayed on the Internet. (with ImageMagick,)
The web application can create a PDF document of the image / information.
When I try to create a PDF document, I got the error message:
FPDF error: Alpha channel not supported .......
Is it easy to solve?

an example of code that creates some of the pictures that I use:

Code: Select all

Set InFile = ..........
Set Corner = .........
Set OutFile = .........
convert %InFile% -define "jpeg:Size=500x500"  -thumbnail 500x500 ^
     ( +clone  -threshold -1 ^
        -draw "fill black polygon 0,0 0,%Corner% %Corner%,0 fill white circle %Corner%,%Corner% %Corner%,0" ^
        ( +clone -flip ) -compose Multiply -composite ^
        ( +clone -flop ) -compose Multiply -composite ^
     ) +matte -compose CopyOpacity -composite -sharpen 0x1.0  %Outfile%.png
This code create an image with:
- Rounded corners
- Transparent background
- OutFile have an PNG format.

For me it works equally well if the image is:
- Rounded corners
- White background
- JPG file format

//Jan
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: FPDF error: Alpha channel not supported

Post by snibgo »

Is it trying to tell you alpha channels aren't supported in PDF?

When test.png has transparency:

Code: Select all

convert test.png test.pdf
convert test.pdf test2.png
works for me, but test2.png has no transparency.

(Ubuntu, IM is 6.4.5 2009-06-04 Q16)
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: FPDF error: Alpha channel not supported

Post by fmw42 »

I believe if you edit your delegates.xml file and choose the right device, you may be able save the transparency. I think I remember seeing some comment about this before from Magick, but I am not sure what that delegate device was. Try searching the archives. Perhaps you can uncover that reply.

Otherwise, you ghostscript directly and it may be able to do that. But I am no expert on ghostscript to tell you what arguments you need.
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: FPDF error: Alpha channel not supported

Post by Albireo »

Thank you for your responce!

The problem is:
I use Joomla and Virtuemart in my site on Internet.

I inserted all pictures and information in a formular,
the result is displayed on the page - everything OK.
On same page I can see 2 small Icons (one print and one for converting to PDF file)
When I want to convert to PDF I get error message on certain images.

Is the problem the transparency in the images corner?
(I don't know how to get white corners :-)
Then I can make an jpg-image insted - its better for me)

FPDF Have something with PHP todo - http://www.fpdf.org/
//Jan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: FPDF error: Alpha channel not supported

Post by fmw42 »

FPDF is the PHP tool on your web site for creating PDFs. This has nothing to do with IM as far as I can tell. If you have buttons on your web site for making PDF, it is coming from your web site and not IM.

If you want to make a jpg from say a gif or png image with white background instead of transparent using IM, then the command line is:

convert image.png -background white -flatten image.jpg
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: FPDF error: Alpha channel not supported

Post by Albireo »

fmw42 wrote:.......This has nothing to do with IM as far as I can tell.........
Yes, the error has nothing to do with IM. but... The image is creted by IM.

Maybe if the IM code, that modifies the image, is printed in some other way the error does not occur.

(for some images I have used this code from Unix) -
This code gives an image with rounded corners on a transparent background.

Code: Select all

convert thumbnail.gif \
     \( +clone  -threshold -1 \
        -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
        \( +clone -flip \) -compose Multiply -composite \
        \( +clone -flop \) -compose Multiply -composite \
     \) +matte -compose CopyOpacity -composite  rounded_corners.png
For me, it would "work" if the image with rounded corners lies on a white background
- it maybe solve the problem.

//Jan
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: FPDF error: Alpha channel not supported

Post by snibgo »

Have you tried fmw42's suggestion of removing transparency?

convert rounded_corners.png -background white -flatten rounded_corners.png
snibgo's IM pages: im.snibgo.com
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: FPDF error: Alpha channel not supported

Post by Albireo »

snibgo wrote:Have you tried fmw42's suggestion of removing transparency?

convert rounded_corners.png -background white -flatten rounded_corners.png
Oops! sorry, I didn't understod his advise directly, I'll try and come back

//Jan
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: FPDF error: Alpha channel not supported

Post by Albireo »

Now I have tried
convert rounded_corners.png -background white -flatten rounded_corners.png
But it failed, I want to look at this tomorrow
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: FPDF error: Alpha channel not supported

Post by fmw42 »

post a link to one of your images so we can use it to test. this command should work fine.

Image

convert hatching_rounded_corners.png -background white -flatten hatching_rounded_corners_white.jpg

Image

NOTE: the white in the corners!

what version of IM are you using? perhaps it is too old and needs upgrading.

type

convert -version

what do you get?
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: FPDF error: Alpha channel not supported

Post by Albireo »

Thank you!

1.
I don't know how / where I can put the images - "my site" is not public jet - working on it.

2.
The white corners is OK! (great) - but I got the same error message :(

3.
My version of ImageMagick is: 6.5.9-2 2010-02-03 Q16

Now, I waiting answer from "Joomla" / "Virtuemart"
if we have config some thing wrong.

I will return

//Jan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: FPDF error: Alpha channel not supported

Post by fmw42 »

what is the error message? is it about IM or about the FPDF. The latter is outside the bounds of IM.
Post Reply