Solved

txt over a picture and converted to png

Posted on 2014-09-02
7
167 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

827 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