Solved

txt over a picture and converted to png

Posted on 2014-09-02
7
166 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
  • 4
  • 2
7 Comments
 
LVL 52

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 52

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Read about why website design really matters in today's demanding market.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

777 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