Jmagick how to add image on an existing image

Jmagick how to add image on an existing image

hi,

I am using Jmagick library in my swing application I want to add an image (say logo) on an existing image. can any one explains how ?

Thanks.

View Answers

August 23, 2012 at 12:52 PM

hi,

In Jmagick you can use the following code to add image on an existing image

You can give one of the following value according to opacity you want to give your image

  1. CompositeOperator.OverlayCompositeOp

  2. CompositeOperator.SoftLightCompositeOp

  3. CompositeOperator.HardLightCompositeOp

For providing the custom opacity you can constitute the following method along with these above value

transparentImage(PixelPacket.queryColorDatabase("ColorName"),int opacity value (0-65535)); Here 0 specifies the fully opacity and 65535 specifies the fully opaque.

Following code may help you to understand how to use these methods and values in to adding an image to an existing image.

ImageInfo ii = new ImageInfo("abc.jpg");
MagickImage mi = new MagickImage(ii);

ImageInfo logoImage = new ImageInfo("logo.jpg");
logoImage.setSize("120 * 60");
MagickImage logo = new MagickImage(logoImage);
logo.transparentImage(PixelPacket.queryColorDatabase("white"),0);
mi.compositeImage(CompositeOperator.OverlayCompositeOp, logo, 120, 80);
mi.setFileName("newImage.jpg");
mi.writeImage(ii);

July 23, 2015 at 12:13 AM

Hi,

the above code overlays transparent image over an existing image. Please tell me how to overlay opaque image over an existing image.

Thanks









Related Tutorials/Questions & Answers:
Jmagick how to add image on an existing image
Jmagick how to add image on an existing image  hi, I am using Jmagick library in my swing application I want to add an image (say logo) on an existing image. can any one explains how ? Thanks.   hi, In Jmagick you
How to write image in Jmagick
How to write image in Jmagick  hi, I am new in Java I am using the Jmagick library, how can I write an image in Jmagick ? Thanks.   hi, You can try this snippet into your code ImageInfo ii = new ImageInfo("abc.jpg
Advertisements
Jmagick get image size
Jmagick get image size  Hi, How I can get the image size while using the Jmagick library? Thanks   hi, the code given below may help you to get the image size when using Jmagick ImageInfo ii = new ImageInfo(path
Jmagick crop image
Jmagick crop image  hi, How can I crop the images using Jmagick Thanks.   hi, To crop an image you can use the cropImage() method of MagickImage. Following code explains how an image may cropped ImageInfo ii = new
How can I generate diff image using Jmagick?
How can I generate diff image using Jmagick?  Hi, I used 'compare' in ImageMagick to produce diff image with metric. example: $ compare -verbose... Jmagick. Can anybody help me get a diff image with similar metric using Jmagick
Jmagick write image to a specific folder
Jmagick write image to a specific folder  hi, I am writing the code for resizing the images into which the image will be get from one location and save the resized images to the another location. for example : get an image
image
image  how to add the image in servlet code
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp
How to add background image to div using CSS?
How to add background image to div using CSS
add image in a row of table
add image in a row of table  i have a table in which i have to add image in its row.i am trying to add the image with the help of label i.e i have a label in which instead of passing text i have inserted image using
add image in a row of table
add image in a row of table  i have a table in which i have to add image in its row.i am trying to add the image with the help of label i.e i have a label in which instead of passing text i have inserted image using
How to add image in panel as background in net beans IDE?
How to add image in panel as background in net beans IDE?  How to add image in panel as background in net beans IDE
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
How to write text on image
How to write text on image  hi, I am using the Jmagick library. I want to write text on image, how is it possible ? Thanks.   hi, I am new in Jmagick but, I used the following code and it might also help you
how to update image in php
how to update image in php  how to update image in php
How to put an image on a JButton?
How to put an image on a JButton?  How to put an image on a JButton
how to insert image into server
how to insert image into server  how to insert an image into sql server and retrieve it using jSP
how to set background image
how to set background image  how to set image in background in that image i want over lay text how it possible in jsp? using flash image how it is overlayed in jsp page? thanks
How to store an image in database
How to store an image in database  Hi........... How to store an image in postgresql using a query. I mean tell me the way to store an image using datatype. I am using the datatype bytea but tell me how to insert the image
How to store image into database
How to store image into database  Hi, all I want to store image into database using Java. Can anyone help me that how can i store image into database... through the following link How To Store Image Into MySQL Using Java
PHP GD add text to image
PHP GD Add Text to Image Example <?php header ("Content-type: image/jpeg");ADS_TO_REPLACE_1 $string = "This is my text"; $font = 4; $width = imagefontwidth($font) * strlen($string) ;ADS_TO_REPLACE_2
UIIMageView Add Image
UIIMageView Add Image "initWithImage" is a image declaring method that is used to declare the image while while creating a UIImageView. Syntax... = [[[UIImageView alloc] initWithImage:one] autorelease]; //to add image on view
how to display image with listview
how to display image with listview  How can i display the list view with the related images from database
PHP GD add text to image
PHP GD  Add text to Images <?php $im = imagecreatetruecolor(300, 300);ADS_TO_REPLACE_1 $w = imagesx($im); $h = imagesy($im); $text..., 1000); header('Content-Type: image/gif');ADS_TO_REPLACE_3 imagegif($im
how to grayscale an image in python
how to grayscale an image in python  Hi, I have may images and it want to greyscale all with python. can it be done? how to grayscale an image... example: from PIL import Image img = Image.open('img.jpg').convert('LA') img.save
How to Increase / decrease the contract of an image?
How to Increase / decrease the contract of an image?  How to Increase / decrease the contract of an image
How to Increase / decrease the brightness of an image?
How to Increase / decrease the brightness of an image?  How to Increase / decrease the brightness of an image
how to use image tag in jsp
how to use image tag in jsp  How to use image tag in JSP
how to convert string to image in java
how to convert string to image in java  how to convert string to image in java? I know we need to convert image to a byte array at some point in my application but do not know how to convert a image into byte string. Please
how to set image - EJB
how to set image   public ActionForward execute(ActionMapping mapping... coding to ireport. this coding only getting database fields. i need add one image in this pdf, how can i set pls help me sir, my image in E:/rose.jpg,how can
How to retrieve image from database
How to retrieve image from database  hi........ How to retrieve image from database when it is stored. I have stored image in postgresql and want... but it retrieves as a string and not complete image can u tel me the conversion
how to display the image in center - Ajax
how to display the image in center  i want to dispaly the image as center of the screen using javascript..while i am clicking the button ..any one give me the code for this one
JMagick Tutorial
of JMagick that writes text on the image. Blow is the program that writes...JMagick Tutorial - Download, install and create simple program JMagick library is Java library for handling the image in Java. It is implemented as thin
How to display image in Swing?
How to display image in Swing Application? Swing is used... requirement to display the image in your swing application then you can learn to display image in swing application here. In this example user enters the name
How to display image in Swing?
How to display image in Swing Application? Swing is used... requirement to display the image in your swing application then you can learn to display image in swing application here. In this example user enters the name
Background Image for Navigation Bar
Background Image for Navigation Bar The tutorial illustrates how to add background image for UINavigationBar. To add a background image to UINavigationBar... and you can see the change on every view. Do not forget to add image into your
How to Store Image using JSF
How to Store Image using JSF  Hi How to upload images in db. using jsf. For jsf photo uploading .. I used this one code for upload image.. But this code haven't option to upload any images . i want to store image in db
UIView Image Background
the desired output.ADS_TO_REPLACE_3 Now, let's find out how you can add image...UIView Image Background In this tutorial, we are going to show you how to add image at background in UIView. There are two different ways of adding
How to create a JTable cell containing Image hyperlink?
How to create a JTable cell containing Image hyperlink?  I'm trying to find out how to create a JTable cell which contains Image, which should.... Can somebody explain me how to add hyperlink (mouse listener) for the each
How to save image on the server by applet
How to save image on the server by applet  HI, in my project I am using applet and creating a chart by jcchart. Now when the chart has ploated... as a gif image on the server directory. Can any Body help me how can I do it Thanks
How to save image on the server by applet
How to save image on the server by applet  HI, in my project I am using applet and creating a chart by jcchart. Now when the chart has ploated... as a gif image on the server directory. Can any Body help me how can I do it Thanks
how to show random image in ASP.net?
how to show random image in ASP.net?  hello bros i saw in many websites..there is a programming of random image changing.... i want to use this in my ASP.NET websites, can any one suggest me code or any kind of help..so that i
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
how to use a image in background in your application form?
how to use a image in background in your application form?  how to use a image in background in your application form
how to get the image of a selected JRadioButton to another panel?
how to get the image of a selected JRadioButton to another panel?  how to get the image of a selected JRadioButton to another panel
how to fetch image from mysql using jsp
how to fetch image from mysql using jsp  how to fetch image from mysql using jsp
How to use flickr image in Flex
How to use flickr image in Flex  Hi, I want to diaply the flickr image in my Flex application. Do I need a crossdomain.xml file on flickr? Please let's know how I can develop such applications. Thanks   Ans
image in database
image in database  how to set image in database and retrieve it using servlet(java)in msaccess

Ads