Merging two images (ASP)

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Jimmeh

Merging two images (ASP)

Post by Jimmeh »

Hi,

I'm trying to use GFLAx to merge 2 gifs from within an ASP page. The problem I have is how to properly define the TYPE of AX_Image from ASP.

Is this possible? Or will I need to write a wrapper COM object to handle it?

Thanks
User avatar
xnview
Author of XnView
Posts: 43163
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Merging from ASP

Post by xnview »

Hi,
Jimmeh wrote:I'm trying to use GFLAx to merge 2 gifs from within an ASP page. The problem I have is how to properly define the TYPE of AX_Image from ASP.Is this possible? Or will I need to write a wrapper COM object to handle it?
A new version of GFLAX will be available the next week, with merging feature.
Regards. Pierre.
Andrew P

Where? Where Merge for ASP?

Post by Andrew P »

I'm very .. I'm very want Merge method for ASP.... :wink:
Maybe some simple function which Merge current image with only one other image?.... something as .Merge( filename, opacity, x, y) ... without any arrays & structures.... ????
Miku
Posts: 1
Joined: Sun Jun 27, 2004 4:34 pm

when the merge option is avaiable?

Post by Miku »

Hi,
thanks a lot for your job, If u need anything call me! I ask you only the merge method. Is it avaiable? :?:

Please make me a little example. Thanks :D

Miku
User avatar
xnview
Author of XnView
Posts: 43163
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: when the merge option is avaiable?

Post by xnview »

Miku wrote:Please make me a little example.

Code: Select all

	.MergeAddFile Path & "\img0.tif", 40, 0, 0
	.MergeAddFile Path & "\img1.tif", 15, 0, 0
	.MergeAddFile Path & "\img2.tif", 15, 0, 0
	.MergeAddFile Path & "\img3.tif", 20, 0, 0
	.Merge
Pierre.
Andy

Merging example

Post by Andy »

Hello!

I've tried your code (after studying the help file) and it always returns "an empty object". I mean, if I try with applying date.gif to existing picture:

Code: Select all

Set sir = Server.CreateObject("GflAx.GflAx")
sir.EnableLZW = true
with sir
  .MergeAddFile Server.MapPath("pic1.gif"),40,0,0
  .MergeAddFile Server.MapPath("pic2.gif"),15,0,0
  .Merge
end with
' any object Method
sir.Crop 100,100,200,200 '<- this line
there comes to error with sir being "empty": GflAx.GflAx.1 error '80004005'
No file opened

Do I have to load an initial image? How to get and use the merged image?

Thank you,

Andy
User avatar
xnview
Author of XnView
Posts: 43163
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Merging example

Post by xnview »

Andy wrote:Hello!

I've tried your code (after studying the help file) and it always returns "an empty object". I mean, if I try with applying date.gif to existing picture:

Code: Select all

Set sir = Server.CreateObject("GflAx.GflAx")
sir.EnableLZW = true
with sir
  .MergeAddFile Server.MapPath("pic1.gif"),40,0,0
  .MergeAddFile Server.MapPath("pic2.gif"),15,0,0
  .Merge
end with
' any object Method
sir.Crop 100,100,200,200 '<- this line
there comes to error with sir being "empty": GflAx.GflAx.1 error '80004005'
No file opened

Do I have to load an initial image? How to get and use the merged image?

Thank you,

Andy
Yes load a picture, or create a new one before merging
Pierre.
mindplay
Posts: 16
Joined: Wed Sep 21, 2005 9:30 am
Location: Denmark

Post by mindplay »

does this work with RGBA formats? e.g. TIFF or PNG with alpha-channel?

I want to use it for watermarking, but it doesn't seem to work.

I modified the "merge.asp" example as follows:

Code: Select all

<HTML>
<HEAD></HEAD>
<BODY>
<%

const AX_JPEG = 1

Dim Path, File

Set ctrl = server.createobject("GflAx.GflAx")
Path = Server.MapPath(".") 
File = Path & "\image.jpg"

With ctrl
	.EnableLZW = TRUE
	.MergeAddFile Path & "\img0.tif", 40, 0, 0
	.MergeAddFile Path & "\img1.tif", 15, 0, 0
	.MergeAddFile Path & "\img2.tif", 15, 0, 0
	.MergeAddFile Path & "\img3.tif", 20, 0, 0
	'.MergeAddFile Path & "\logo.png", 20, 0, 0
	.Merge

   .SaveFormat = AX_JPEG
   .SaveJPEGQuality = 70
   .SaveBitmap Path & "\result.jpg"
   
end with

set ctrl=nothing
%>
<IMG SRC="result.jpg">
</BODY>
</HTML>
But when I uncomment the merge command for "logo.png", the SaveBitmap command returns error '80004005' ("no file opened").

I've also tried with a TIFF instead, but same result.

Do I have to save in PNG or TIFF format, and if so, specifically what settings should I use when saving out of Photoshop?

Is merging with alpha-channel supported in the first place?

You can get my "logo.png" and "logo.tif" I use for testing here:
http://www.danline.dk/test/logo.zip

...

By the way, AX_JPEG was set to 3 in the provided example - which is wrong, according to the documentation the code for JPEG should be 1.
User avatar
xnview
Author of XnView
Posts: 43163
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post by xnview »

mindplay wrote:does this work with RGBA formats? e.g. TIFF or PNG with alpha-channel?
Ok, so don't use Merge, but DrawImage
Pierre.
mindplay
Posts: 16
Joined: Wed Sep 21, 2005 9:30 am
Location: Denmark

Post by mindplay »

that works, awesome! thanks! :)
mindplay
Posts: 16
Joined: Wed Sep 21, 2005 9:30 am
Location: Denmark

Post by mindplay »

oh, and here's the corrected code for placing the "logo.png" in the lower-right corner, on top of the image.

Code: Select all

With ctrl
	.EnableLZW = TRUE
	
	.LoadBitmap Path & "\logo.png"
	LogoW = .Width
	LogoH = .Height
	
	.LoadBitmap File
	.DrawImage Path & "\logo.png", .Width-LogoW, .Height-LogoH

   .SaveFormat = AX_JPEG
   .SaveJPEGQuality = 70
   .SaveBitmap Path & "\result.jpg"
   
end with