Image Events pad command
Hi all
Does anyone know if it's possible to use the "pad" command in Image Events to add white pixels as opposed to black?
I have a script which shrinks PDFs and converts them to JPGs for display on a web site, but the proportions of the PDFs don't quite match up to those required for the JPGs. It would be handy if I could add five white pixels down each side of the JPGs, but "pad" only seems to add black ones.
Cheers,
H
H,
Image Events can't do that.
iMagine Photo which is like Image Events but with more functionality can do this.
The following script will replace the contents of the selected jpeg file with a new image that has a 5 pixel wide border down the left and right edges of the image.
iMagine Photo is free and can be downloaded from:
http://www.yvs.eu.com/downloading.html
Kevin
------ Start Script
on run
AddWhiteBorder()
end run
on AddWhiteBorder()
set thisFile to choose file with prompt "Select a jpg file: "
tell application "iMagine Photo"
set thisImporter to import graphic thisFile
set {x, y, xDim, yDim} to the natural bounds of thisImporter
set xDim to xDim + 10 -- add 5 pixels to the the width of each side
set thisDocument to make graphic document with properties {dimensions:{xDim, yDim}}
tell thisDocument to create composition element with properties {class:filled rectangle, bounds rectangle:{0, 0, xDim, yDim}, color:{65535, 65535, 65535}}
set the drawing destination of thisImporter to thisDocument
set the top left point of thisImporter to {5, 0}
draw thisImporter
set the export file type of thisDocument to "JPEG"
set the export file location of thisDocument to the file location of thisImporter
export thisDocument
close thisImporter
close thisDocument
end tell
end AddWhiteBorder
------ End Script
Similar Messages
-
Image Events not resizing tiff
Hello,
I have been trying to get some results from Image events for 5 hours now.
Below is what I will use to express the issue I am encountering.
When running the following script in script editor it appears to do what is asked of it but in the end the file is unchanged.
It is almost as if Image Events is not working.
Would someone please provide a step of troubleshooting for me?
When I use return I get the file I selected.
====Script=====
set this_file to choose file
try
tell application "Image Events"
launch
set this_image to open this_file
scale this_image to size 318
pad this_image to dimensions {320, 240}
save this_image with icon
return this_image
close this_image
end tell
on error error_message
display dialog error_message
end try
====END Script====
Thank you very much.Thanks for checking this Pierre.
What I meant by saying it appears to do what is asked of it... is that I didn't receive any errors.
I just did a major edit on the post because it was that my tiff files I was trying to process were CMYK. I converted them to RGB in Photoshop and they processed just fine.
Not a solution though. I don't want to have to go through Photoshop because I have thousands of images to process.
I tried to find the command to convert from CMYK to RGB in Image Events and can't find that.
Can someone help me with the command to do that conversion in Image Events or at least without having to run Photoshop to do it?
Thank you so very much in advance.
Jeff
Message was edited by: Jeffrey DeRousse
Message was edited by: Jeffrey Derousse -
Quality of JPEG when being converted by Folder Actions (Image Events)
I take a lot screenshots with Command + Shift + 3/4. They are in PNG and I love them. Yet, I need to send them via email sometimes.
I convert them to JPEG using Preview, but it is time-consuming when especially I have hundreds of them.
I have just learnt that it is possible to do convert in batch using Folder Actions. However, I meet few very serious problems.
1. In Preview, I could choose the quality of JPEG before converting. But, there is no such option in Folder Actions. I even searched online to try to modify the script and it seems that nobody cares about the quality of converted JPEG.
My question: What is the quality of JPEG converted? And, is it possible to modify it?
2. Since I do not know the quality of conversion using Folder Actions, I tried different qualities using Preview and match the outputs with those using Folder Actions. I got no result. As Preview is using Core Image as the processing architecture.
My question: What is the image processing architecture adopted by Image Events?
3. If the quality is unchangeable, can anyone teach me how to write a new script to do the conversion using Preview?
I really hope Mac OS gurus could explain these to me and possibly solve my problems. I am interested to learn the AppleScript part to modify it.
Thank you very much.It is the original folder action script from Mac OS. Here is the copy.
Could you help me as well where to add the "compression level"? Also, what do "high", "low" and "medium" mean, in % just like Preview, if they use the same image processing architecture?
Again, thank you very much for quick reply.
================
Image - Duplicate as JPEG
This Folder Action handler is triggered whenever items are added to the attached folder.
The script creates a JPEG version of the file, but leaves a copy of the file
in its original format. If the original file is already in JPEG format, the script does
not duplicate the file.
Copyright © 2002–2007 Apple Inc.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
property done_foldername : "JPEG Images"
property originals_foldername : "Original Images"
property newimage_extension : "jpg"
-- the list of file types which will be processed
-- eg: {"PICT", "JPEG", "TIFF", "GIFf"}
property type_list : {"TIFF", "GIFf", "PNGf", "PICT"}
-- since file types are optional in Mac OS X,
-- check the name extension if there is no file type
-- NOTE: do not use periods (.) with the items in the name extensions list
-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}
property extension_list : {"tif", "tiff", "gif", "png", "pict", "pct"}
on adding folder items to this_folder after receiving these_items
tell application "Finder"
if not (exists folder done_foldername of this_folder) then
make new folder at this_folder with properties {name:done_foldername}
end if
set the results_folder to (folder done_foldername of this_folder) as alias
if not (exists folder originals_foldername of this_folder) then
make new folder at this_folder with properties {name:originals_foldername}
set current view of container window of this_folder to list view
end if
set the originals_folder to folder originals_foldername of this_folder
end tell
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
tell application "Finder"
my resolve_conflicts(this_item, originals_folder, "")
set the new_name to my resolve_conflicts(this_item, results_folder, newimage_extension)
set the source_file to (move this_item to the originals_folder with replacing) as alias
end tell
process_item(source_file, new_name, results_folder)
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
on resolve_conflicts(this_item, target_folder, new_extension)
tell application "Finder"
set the file_name to the name of this_item
set file_extension to the name extension of this_item
if the file_extension is "" then
set the trimmed_name to the file_name
else
set the trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name
end if
if the new_extension is "" then
set target_name to file_name
set target_extension to file_extension
else
set target_extension to new_extension
set target_name to (the trimmed_name & "." & target_extension) as string
end if
if (exists document file target_name of target_folder) then
set the name_increment to 1
repeat
set the new_name to (the trimmed_name & "." & (name_increment as string) & "." & target_extension) as string
if not (exists document file new_name of the target_folder) then
-- rename to conflicting file
set the name of document file target_name of the target_folder to the new_name
exit repeat
else
set the name_increment to the name_increment + 1
end if
end repeat
end if
end tell
return the target_name
end resolve_conflicts
-- this sub-routine processes files
on process_item(source_file, new_name, results_folder)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
try
-- the target path is the destination folder and the new file name
set the target_path to ((results_folder as string) & new_name) as string
with timeout of 900 seconds
tell application "Image Events"
launch -- always use with Folder Actions
set this_image to open file (source_file as string)
save this_image as JPEG in file target_path with icon
close this_image
end tell
end timeout
on error error_message
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end try
end process_item -
Help needed with Image Events problem
Hi there I'm writing what I thought was a simple script to convert a folder full of images from jpg to tiff. But the script fails when trying to convert the first image in the folder. Instead of converting the image, Preview opens with the image shown and I get this error message: error "The variable ImageRef is not defined." number -2753 from "ImageRef".
I have seen some posts about other people having the same problem, but I haven't seen any solutions.
Here's the script.
on run
tell application "Finder"
set PicturesFolder to ((path to home folder) as string) & "Pictures:SenseCam" as alias
set Photographs to (get entire contents of PicturesFolder) as alias list
end tell
tell application "Image Events"
launch
repeat with Photo in Photographs
if (Photo as string) ends with "jpg" then
set ImageRef to open Photo
save ImageRef in Photographs as TIFF
close ImageRef
end if
end repeat
end tell
tell application "Finder"
repeat with Photo in Photographs
delete Photo
end repeat
end tell
end run
Thanks in advance for any help.
JohnHello
You may try something like the modified code below.
Noticiable changes :
#1 - Removed the parentheses. Your original code won't yield alias list but a list of finder objects, which is the reason why Preview opens the image. (The statment 'open finderObject' behaves the same as double clicking it in Finder)
#2 - Only delete the original jpeg files which are converted to tiff.
#3 - Build new path for converted image.
#4 - Save in new path. (When saving image in a format other than its original format, always save the image to a new file and do not attempt to overwrite the source file.)
cf.
http://www.macosxautomation.com/applescript/imageevents/08.html
on run
tell application "Finder"
set PicturesFolder to (path to home folder as string) & "Pictures:SenseCam:" as alias
set Photographs to get entire contents of PicturesFolder as alias list -- #1
end tell
set DonePhotos to {} -- #2
tell application "Image Events"
launch
repeat with Photo in Photographs
set Photo to Photo's contents
set oldPath to Photo as string
if oldPath ends with ".jpg" then
set newPath to oldPath's text 1 thru -5 & ".tif" -- #3
set ImageRef to open Photo
save ImageRef as TIFF in newPath -- #4
close ImageRef
set end of DonePhotos to Photo -- #2
end if
end repeat
end tell
tell application "Finder"
delete DonePhotos -- #2
end tell
end run
Hope this may help,
H -
When I try to save an image under the command 'save as' it will only let me save as file types 'firefox document' or 'all files' and when I try to look at them later they dont work. How can I save an image as the same file type it is on the web site?!
== This happened ==
Every time Firefox opened
== I updated to one of the firefox versions (Not sure which one it was)Thanks Alex, but sadly I already tried that. Neither .docx or .xlsx files show up in the content list. They both show as a Chrome HTML document so changing how Firefox addresses those doesn't help since it thinks its the same type of file. I don't think I can manually add files into the "Content Type" left side nav.
-
The following script works correctly:
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}
global eventsFolder, ProcessedfolderName, events_Folder
on runConversion(theItems)
activate "Finder"
set saveFolder to choose folder with prompt "Save resized pictures where?" without multiple selections allowed and invisibles
tell application "Image Events"
launch
set newWidth to 120
if (count items of theItems) is greater than 0 then
repeat with anItem in theItems
set theName to the name of anItem
tell application "Finder" to set myNewFileName to (saveFolder as string) & "tmb_" & theName
set imageFile to (open anItem)
scale imageFile to size newWidth
save imageFile as PNG in file myNewFileName
close imageFile
end repeat
else
display dialog "Nothing to convert."
end if
end tell
end runConversion
mount volume someVolume
set root_Folder to root_Folder as alias
set events_Folder to events_Folder as alias
set theStr to (current date) as string
set d to date theStr
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
tell application "Finder"
set events_Folder to events_Folder as alias
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
set new_FileFolder to make new folder at events_Folder with properties {name:ProcessedfolderName}
move (every file of events_Folder whose name ends with ".png") to new_FileFolder
set oldFiles to every file of events_Folder
set thecount to number of items of oldFiles
end tell
set theFiles to choose file with prompt "Choose the files" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)
activate
BUT if I modify it to the following, it gets hung up on "scale imageFile to size newWidth"
error "The variable imageFile is not defined." number -2753 from "imageFile"
Maybe it has something to do with the line
'set theFiles to choose file with prompt "Choose the files" of type openTypes with multiple selections allowed without invisibles'
which is not in the broken script.
The broken script is as follows:
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}
global eventsFolder, ProcessedfolderName, new_FileFolder, imageFile
on runConversion(theItems)
activate "Finder"
set saveFolder to new_FileFolder
set theItems to every file of the saveFolder
tell application "Image Events"
launch
set newWidth to 120
if (count items of theItems) is greater than 0 then
repeat with anItem in theItems
set theName to the name of anItem
tell application "Finder" to set myNewFileName to (saveFolder as string) & "tmb_" & theName
set imageFile to (open anItem)
scale imageFile to size newWidth
save imageFile as PNG in file myNewFileName
close imageFile
end repeat
else
display dialog "Nothing to convert."
end if
end tell
end runConversion
mount volume mountVolume
set root_Folder to rootFolder as alias
set events_Folder to events_Foler as alias
set theStr to (current date) as string
set d to date theStr
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
tell application "Finder"
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
set new_FileFolder to make new folder at events_Folder with properties {name:ProcessedfolderName}
move (every file of events_Folder whose name ends with ".png") to new_FileFolder
set oldFiles to every file of events_Folder
set thecount to number of items of oldFiles
end tell
set theFiles to every file of new_FileFolder
runConversion(theFiles)
activateSeveral lines of the “broken” script seem to be badly written, for example:
set root_Folder to rootFolder as alias -- rootFolder instead of root_Folder
set events_Folder to events_Foler as alias -- Foler instead of Folder
Message was edited by: Pierre L. -
Image Events save as PICT broken?
An old script that worked in Lion is not working in Mountain Lion.
Here is a test example:
tell application "Image Events"
launch
set theImage to open "/tmp/c13.jpg"
save theImage as PICT in file "/tmp/image.pict"
close theImage
end tell
If the output file already exists, this script does nothing and does not complain. If the output file does not already exist, I get an error that the image "doesn't understand the save message".
Other image file formats besides PICT work fine.
Any ideas?Hi,
The QuickDraw API (Macintosh PICT format) have long been obsolete (they've mostly been
deprecated since Mac OS X 10.4). But we still use them in a few places
(in 32-bit mode) for backwards compatibility. (QuickDraw APIs are unavailable in 64-bit mode).
Apple will remove the 32-bit system libraries in some future version of OS X and dropping support for 32-bit apps.
Solution : Try selecting 'Open in 32 Bit Mode' in the Finder's info window for the application "Image Events"
I know it works for Preview on OS X 10.8 (it can still open PICT format), but I don't know for "Image Events". -
How can the alpha channel be removed in an image with the command sips?
I solved it by converting the image to jpeg with best quality, but it's a less than optimal solution.
Is there a better way?
I want to know because I'm developing a bash script to manipulate images.
Thank you.I'm developing a Bash script to automate PNG compression.
Converting true color images is often a good idea to reduce file size dramatically but transparency doesn't look any good then. So removing the alpha channel is usually the thing to do.
I think Apple's platform is very easy to use but as soon as I dig deeper into the system it often becomes frustrating. Why isn't there a simple way to do something so simple and basic as removing alpha channels from images from the command line? Sips should be the answer but doesn't seem to be, unless I've missed something, but the manual doesn't give any clue. -
Eliminate the border displayed around the image in a command hyperlink
How can i please eliminate the border displayed around image in a command hyperlink component.
Thanks.That's just a layout issue. Apply CSS accordingly.
-
Should every SQL query have its own event and command?
Hello,
I am developing an application using Cairngorm. My app uses SQL databases.
I'm creating a separate event and command for each SQL query my application requires. I end up with many events and commands - twenty different event/command pairs and I'm not even done yet.
I was wondering if this is the right way to go, or if somehow similar SQL queries should be grouped together in the same event/command, and if so, how would I implement that elegantly?
I've never used Cairngorm before so I want to make sure I do it correctly.
Thank you for your time and any assistance you can offer.From my point of view, writing any SQL query or making queries directly from the presentation layer (eg. flex) to the db server it's almost always incorrect, awfull and maybe even insecure. The client layer should be more independent from the implementation layer as for instance the db server you are using. Instead you should call services on the server side and then they should have a DAO layer o whatever where the queries are done. You could then invoke one of this services and pass parameters that indicates what you want to do. (except you are using remoting where you will be invoking methods directly)
Consider the case where you have a Java implemented service layer, you could be using hibernate to access the database and not writing a single line of SQL (maybe some HQL) and then you could do all the queries you need and return the beans retrieved from the database to the client layer using AMF3 and it's serialization/deserialization mechanisms. In a future you could modify your app to use JPA and then this layer use hibernate, then you client layer will remain the same the only changes will be done under the DAO layer.
So again, in my opinion, db server should never be accesed directly from the presentation layer (Flex, Air or whatever) but from the backend services and this sould be completly abstract to the client layer. I have seen some people trying to do SQL queries from Flash but that it's giving a task to the Flash player it has never been intended to do. A miss use of the thin client the Flash Player is and an bad architecture.
It would be great to hear others opinions. -
EVENT FIRST COMMAND AFTER SELECT
Dear friends
I'm now using Gemalto Developer's Suite and I want to test this event. However, I try different ways but fail to accomplish my test.
Do you know any materials, or just anything about this event? I searched throughout various sources, materials but all I have now is a small piece of information in GSM 43.019
Upon reception of the first command received by the GSM application after it has been selected or after the ATR if it is the default application, and before the Status >Word of the processed command has been sent back by the GSM application, the toolkit framework shall trigger all the toolkit applets registered to this event.
If the first command received by the GSM application is a toolkit applet triggering command (e.g. TERMINAL PROFILE), the toolkit applets registered on the >EVENT_FIRST_COMMAND_AFTER_SELECT event shall be triggered first.
The ProactiveHandler and the ProactiveResponseHandler shall not be available at the invocation of the processToolkit method of the toolkit applet on the >EVENT_FIRST_COMMAND_AFTER_SELECT event.From this material, I think it's quite vague to understand clearly this event.
Thanks in advance,
Jason
Edited by: Jason Gosling on Oct 19, 2011 7:29 PMhi Jason.
This is automatic event that was born by OS instead mobile.
When OS received the first command "00 A4 04 00 00 0xXX + AID APPLET GSM" from User, OS will look in the ToolkitApplet Registry table and find the applet with EVENT FIRST COMMAND AFTER SELECT, then OS call method "process toolkit" of this applet.
the called applet will do something that it want. Maybe send data to ME.
When method done, OS continue action normally.
This is for GSM applet on JavaCard. And the GSM applet is not default program.
For the case: GSM is default, that mean OS automatic select GSM APPLET when it starts, no need to any command form ME or User, OS auto create this event and look toolkitapplet to run processToolkit method.
hope this is fun !! -
Applescript Image Events appears to have memory leak (or I don't know what I am doing)
Using Image Events to create images and thumbnails for a website. The following code results in very large memory leaks in Image Event process. I have documented results of test runs in the comments.
The leak (or poor coding on my part) results in a total system halt if I attempt to process more than about 400 images at a time. Basically, I run out ot physical memory. I am running a new model 13" MBP with 8GM RAM. I have to manually stop Image Events to reclaim the memory (or reboot of course).
Any help/suggestions would be appreciated.
(* test memory leak in Image Events *)
tests with 58 photos selected in iPhoto
5.7 MB left in Image Events after run with only open and close
22.0 MB left in Image Events after run with open, save and close
45.9 MB left in Image Events after run with open, scale, save and close
A run with 382 photos selected used OVER 3.8 GB (gigabytes) and the
mac ran out of physical memory so I had to stop the test.
tell application "Finder"
set imageFolder to folder "test" of home as alias
end tell
tell application "iPhoto"
set currPhotoList to the selection
repeat with currPhoto in currPhotoList
log name of currPhoto as string
set theImagePath to image path of currPhoto
tell application "Image Events"
launch
set theImage to open theImagePath
scale theImage to size 128
save theImage in imageFolder as JPEG with icon
close theImage
end tell
end repeat
end tell
--- end of code exampleDoes the following code do any difference? Most likely no I guess… but better try than nothing.
tell application "Finder"
set imageFolder to folder "test" of home as text -- instead of “as alias” (see theTargetPath below)
end tell
set theImagePaths to {}
set theImagePathsRef to a reference to theImagePaths -- faster with big lists
tell application "iPhoto"
set currPhotoList to the selection
repeat with currPhoto in currPhotoList
log name of currPhoto as string
get POSIX file (image path of currPhoto) as alias -- faster ?
copy result to the end of theImagePathsRef
end repeat
end tell
tell application "Image Events"
launch
repeat with theImagePath in theImagePaths
set theImage to open theImagePath
scale theImage to size 128
set theTargetPath to (imageFolder & name of theImagePath)
save theImage in theTargetPath as JPEG with icon
close theImage
end repeat
end tell -
Change image resolution using image events
Does anyone have an applescript to change image resolution using image events in OSX? I want to optimize my images for iWeb. I want to use a shell script in an applescript as a droplet or as a service in Automator. I'd like to leave the original intact.
No? Oh...ok den. No Applescripts at all.
-
Applescript to change image resolution using image events
Does anyone have an applescript to change image resolution using image events in OSX? I want to optimize my images for iWeb. I want to use a shell script in an applescript as a droplet or as a service in Automator. I'd like to leave the original intact.
For what type of use in iWeb are these photos intended? If it's for adding to a page (not a photo or album page) iWeb does a great job of optimizing. See my post in this topic: Re: Photo Resolution in iWeb.
You can optimize an entire site with an application like Web Site Maestro. It can reduce the site's size by up to 49%. Here's the settings available for the optimization:
Click to view full size
It's very effective.
OT -
Upon waking from sleep or restarting Firefox the program won't allow track pad scrolls or show opening of a new tab whether by link or command. Once the program has been open a few minutes all the tabs that were attempted show up at once and track pad functionality returns. No other programs behave in this manner during this period of time. Using Firefox 8.0.1 with OS 10.6.8.
Any ideas? Thanks!I tried deleting Firefox's cache from user/library/caches/firefox/profiles/XXXXXXXX.Default User/Cache. I also deleted mozilla-media-cache and startupCache with no luck. I then tried reinstalling after deleting Firefox under the application folder and deleting org.mozilla.firefox.plist in the user/library/preferences folder per instructions - no luck there as well.
The problem persists for example after opening Firefox for the first time hours after turning on the computer...
Maybe you are looking for
-
Problem with isAttributeUpdateable in deployed ADF appliction on AS 10.1.2
I am trying to track down the source of an error that only appears when I deploy my ADF application to my Oracle Application server. The problem does not occur on the built in OC4J. I have already tried the ADF run time installer prior to deploying m
-
Yum - No package dkms available
Dear Experts, 64 bit Server is: lsb_release -a LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: EnterpriseEnterpriseServer Description: Enterprise Linux Enterprise Lin
-
MacBook No Fire Wire? Getting Sony MiniDV Into Mac
I am new to Mac, this is our first Mac and I am loving it. I have a Sony MniDV camcorder. I want to import the video into my Mac. My camera requires a firewire connection, but the macBook doesnt have one. Am I out of luck or is there a way to make th
-
Moving the Focus with the TAB key in a JTextArea Component
Dear Friends, I have exhausted all options of moving focus from JTextArea to next component. I have also tried all suggestions available in this forum. But i'm not able to solve my problem. Can any one help me. Thanx in advance.
-
Slide Text works on computer, not on iPad
I have several lines of text and numbers in a text box on my slides. They look great on my computer, but the formats incorrectly on the iPad, from which it will be projected. How can I fix this so the text doesn't wrap around to the next line? Do I n