Solved

txt over a picture and converted to png

Posted on 2014-09-02
7
174 Views
Last Modified: 2014-09-24
Hello suppose I have a string variable called "stringbutton" that could be in vbscript, inside the same directory will be a picture called "button.png"; now what code could be in vbscript to do that depending of the value of "stringbutton" then create a new picture in the same directory with the file name of "stringbutton" value without spaces and that new image will be, like background the "button.png" original image and over the text value of the string "stringbutton" but with full spaces here, just the spaces must be deleted on the file name but not on the picture to display.

   For example:

   stringbutton="element to discover in science"
   then the new resulting created picture in same directory will have this file name "elementtodiscoverinscience.png" and that image has like background the original "button.png" image and over the "stringbutton" value with full spaces here in other words "element to discover in science"' in resume if you click to see the image "elementtodiscoverinscience.png" you will see a picture with background of the "button.png" image mixed with an over text in that background that will say "element to discover in science"
   
   Someone could help in post a code to do?
   The code I need is to place in one html lage in the middle of:

<%

put code here

%>
   Could be used Imagemagick or any program to do.
Thank you
0
Comment
Question by:coerrace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 40301012
I can show you how to do this with image magick but you are better off just using css.   http://jsbin.com/tahibe/1/edit?html,output

<!DOCTYPE html>
<html>
<head>
  <style>
    .img span{

   position: absolute; 
   top: 20px; 
   left: 20px; 
   width: 100%;  
  

}
  </style>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div class="img">
    <img src="http://placehold.it/350x150">
    <span>This is some text</span>  

</div>  
</body>
</html>

Open in new window

0
 

Author Comment

by:coerrace
ID: 40301031
Ok that is ok for regular HTML but I want that result being stored automatic in a new PNG, in other words your 2 resulting elements:

    <img src="http://placehold.it/350x150">
    <span>This is some text</span>  

Stored in a new file called "elementtodiscoverinscience.png" and the source of the text comes from a source stringbutton="element to discover in science" and the file name is removeing spaces for that stringbutton variable.
   Then is needed to manipulate in other way to store in hard drive.
Thank you
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 40301111
Do you have imagemagick set up?  

My own experimentation with this has proven text in some cases does not come out as expected. If you can deal with using css, I think you are much better off.

http://www.imagemagick.org/Usage/text/
http://www.imagemagick.org/Usage/annotating/

Let me know if you need help converting this to vb.  If you have used imagemagick already, this should make sense.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:coerrace
ID: 40301125
I have installed imagemagick , but could be another thing really I don´t know how to do, but yes if possible to convert to VBSCRIPT not visual basic,  just vbscript and to store the image in hard drive like I explain in main topic if possible.
Thank you
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40303968
my guess is that you want the Annotating option for IM as Scott linked to above..

as a test, let's take a blank asp page and see if we can just get the text to appear on the image, from there we can move on to incorporating it directly into your code. have a look at the code below and see if you can get it working on a test page

<%
Set Img = Server.CreateObject("ImageMagickObject.MagickImage.1")

stringbutton="element to discover in science"
strButtonFile = "<hard code a path here for testing>"
newFileName = "<hard code a path here for testing>"

 Img.Convert stringButtonFile, "-background Khaki",  label:'" & stringButton & "'", "-gravity Center", "-append",    newFileName      

%>

Open in new window


again, this is just to test writing the text where you want it, we'll worry about converting the string button text to the file name later on

**edit - missed a comma
0
 

Accepted Solution

by:
coerrace earned 0 total points
ID: 40333785
we did another thing to solve modify a main page this not worked at all
0
 

Author Closing Comment

by:coerrace
ID: 40341145
Work solved in other way
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question