Solved

txt over a picture and converted to png

Posted on 2014-09-02
7
163 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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 32

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now