A script to increase the minimum canvas size? (Like Fit Image, but with just my canvas)

For starters to be clear, I'm looking to manipulate canvas size. Not image size.
I want to create a script to automatically increase the width and height of my canvas in Photoshop to a specific size when necessary. I only want this to happen if my canvas is less than that specified size. For example: Let's say my canvas size is 300x250. I want the canvas to be at LEAST 600x600. If I run my action it will increase the canvas size to 600x600 for me. If I run this same script on an image where the canvas size is already 700x700, it won't do anything at all to it because both the width and height are equal to or greater than my target size.
It would also need to work with the height and width on an individual basis. If my image is 400x800, the action would increase my width from 400 to 600, but it would leave the height of 800 alone. So the final canvas size will end up being 600x800.
It's kind of like the "Fit Image" option in Photoshop, but I only want to manipulate my canvas size, NOT my image size.

It is possible.
But if you hope that the dialog remembers the last settings that would require storing those values (which could be done with a txt-file at some pre-defined location), but it would make the Script a bit more complicated.
// resize canvas in either direction if it is below a defined minimum;
// 2011; use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
// dialog;
var dlg = new Window("dialog", "increase width and height if under", [500,300,750,380]);
// filter for checking if entry is numeric, thanks to xbytor;
numberKeystrokeFilter = function() {
          if (this.text.match(/[^\-\.\d]/)) {
                    this.text = this.text.replace(/[^\d]/g, "")
          if (Number(this.text <= 0)) {this.text = 5};
          this.text = Math.round(Number(this.text));
// fields for entry;
dlg.hor = dlg.add("edittext", [14,15,88,35], "600", {multiline:false});
dlg.hor.onChange = numberKeystrokeFilter;
dlg.horText = dlg.add("statictext", [93,15,118,35], "px", {multiline:false});
dlg.ver = dlg.add("edittext", [129,15,210,35], "600", {multiline:false});
dlg.ver.onChange = numberKeystrokeFilter;
dlg.verText = dlg.add("statictext", [215,15,240,35], "px", {multiline:false});
dlg.hor.active = true;
// ok- and cancel-button;
dlg.buildBtn = dlg.add("button", [13,45,118,68], "OK", {name:"ok"});
dlg.cancelBtn = dlg.add("button", [128,45,240,68], "Cancel", {name:"cancel"});
// show dialog;
dlg.center();
// show dialog;
var myReturn = dlg.show ();
// proceed if ok-ed;
if (myReturn == 1) {
var myDocument = app.activeDocument;
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// set the minimum values;
var minWidth = Number(dlg.hor.text);
var minHeight = Number(dlg.ver.text);
// get current ones;
var theWidth = myDocument.width;
var theHeight = myDocument.height;
// resize canvas;
myDocument.resizeCanvas(Math.max(minWidth, theWidth), Math.max(minHeight, theHeight), AnchorPosition.MIDDLECENTER);
// reset;
app.preferences.rulerUnits = originalRulerUnits;

Similar Messages

  • Is there a real way to increase the system font size yet?

    I got a new Mac Pro (2013 model) to use with my Dell U2711 monitor which has a native screen resolution of 2560x1440.  After spending some significant time fighting with cables (HDMI and DVI will not allow for full native resolution due to a Dell issue, only Display Port works), I finally got my screen working at the full native resolution.  Since I am going from a previous resolution of 1920x1080, as you can imagine, the text is pretty small.
    I am running OS X Mavericks 10.9.1. 
    I searched the forums for a way to increase the default font size and found a ton of posts, but most posts were older or got the response "Change your screen resolution" which translates to "Drop your resolution to a non-native and clearly inferior mode" or buy some special computer reading glasses.  These are not real solutions for me.  I do professional photo editing so being able to have a high screen resolution is important.  With a great OS I would think there would have to be a way to increase the font size.  (Surely if Windows can do it, so can Mac OS).  I know I can do it for some individual applications like iTunes, Safari, Chrome, etc.  But I can't find a way to increase it for apps that don't have a font size option or for default mac applications like the action bar.  Is this an issue that just keeps being ignored or is there a solution yet?
    With 4K displays already on the market and 8K ones being shown off at CES, if we can't control the default font size, are the next set of solutions going to be "Go buy a really big magnifying glass"?  If the current answer is still that I'm SOL, could we please get some feedback to the product group that this is a real issue and it's only going to get worse with higher res monitors coming.  I don't think many people will be happy dropping their 4K displays to 1080 resolution or lower just so they can read the text.

    Download and run the free application TinkerTool (not "TinkerTool System"), select the Fonts tab, and change the font sizes.

  • How do I increase the menu font size for Bible Fox?

    I know how to increase page text size etc, but using (brown) Bible Fox theme, I can't increase the menu font size. Is there a way to do this?

    You can try to increase the String pref layout.css.devPixelsPerPx from 1.0 to 2.0 in 0.1 steps to see what works best.<br />
    In Firefox 3.6 and later this pref is a String value parsed to a float and allows to fine tune the dimensions of all elements more precisely.
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the <i>"Enter"</i> key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.

  • How to know the "minimum panel size" property

    I want to know the "Minimum Panel Size" specified in the "VI properties" by programming. It's very important to get this information, because my panel size changes over the execution and I need the minimum panel size available. I can’t use the panel bound property because it return me the actual size of the panel.
    Any idea?
    Thanks for your help.
    Solved!
    Go to Solution.

    There is no property to directly return the minimum panel size that you set.
    You can however trick it into giving it to you. Since you can't use the "Panel Bounds" property to make a window smaller than it's set minimum, You can try to set it to 0,0 size, then read the size and subtract the left from right and top from bottom to get the size. The panel will actually resize to the minimum, but will return an error if you try to go below that.
    The attached VI shows this working. I only tried this 7.1, so if you have an earlier version, let me know and I'll save it back.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    Get minimum panel size setting.vi ‏40 KB

  • How do you increase the Streaming buffer size in iTunes 10

    When I try to listen to the radio in ITunes it plays for 30 seconds then says rebuffering stream.
    I just upgraded to an iMac and my old dinasaur G4 does not have this problem.
    I've read things saying to increase the Streaming buffer size but I don't see how to do this anywhere.
    J

    I don't think that is possible with newer iTunes versions.

  • Anybody know how to increase the plugin file size limit in Photoshop CS6 to greater than 250 mb?

    Can anyone tell me if it is possible to increase the plugin file size limit in Photoshop CS6 to greater than 250 mb and how to do it? Can plugins running in PSCC handle larger file sizes than CS6?

    Wow, thanks for getting back to me!!
    I am running the latest version of HDR Soft Photomatix Tone Mapping Plug-In - Version 2.2 in Photoshop CS6 on a fully loaded solid state MacBook Air. When I attempt to process files exceeding 250 mb with the plugin I get an error message and the plugin will not work. The plugin works fine with anything south of 250 mb. I have also optimized the performance settings in CS6 for large file sizes.
    The standalone version of HRD Soft’s Photomatix Pro easily processes files well in excess of 300 mb.
    I have contacted Photomatix support and they say that 250megs is simply the max file size that Photoshop will allow to run a plugin with.
    So is there any setting that I’m overlooking in Photoshop CS6 that will allow me to process these large files with the plugin? Or if there is indeed a file size limit for plugin processing in CS6 is the limit higher in CC?
    Thanks in advance for your help.

  • Increase the Oracle datafile size or add another datafile

    Someone please explain,
    Is it better to increase the Oracle datafile size or add another datafile to increase the Oracle tablespace size?
    Thanks in advance

    The decision must also includes:
    - the max size of a file in your OS and/or file system
    - how you perform your backup and recovery (eg:do you need to change the file list)
    - how many disks are available and how they are presented to the OS (raw, LVM, striped, ASM, etc.)
    - how many IO channels are available and whether you can balance IO across them
    Personal default is to grow a file to the largest size permitted by OS unless there is a compelling reason otherwise. That fits nicely with the concept of BIGFILE tablespaces (which have their own issues, especially in backup/recovery)

  • How to increase the Java Heap size ?

    Hi
    I am new to java. I have created a java application and i configured in Eclipse. While running my application it throws an error that
    "Exception in thread "Thread-21" java.lang.OutOfMemoryError: Java heap space"
    i have used threads in my application. Then i searched some forums regarding this. The answer i got is "Increase the java heap size" using
    "java -Xms64m -Xmx256m prog" in command prompt. while running.
    But i am not running my application in command prompt. I used Eclipse to run my application. Here my ultimate question is how to set the heap size while running the application in Eclipse and where to set in Eclipse.
    Kindly help me.
    Regards
    Ramesh E

    i have used 20 threads to extract the datas
    Then parallel i am starting one more thread to process the data. Means that i am starting 21st thread. In thread is throwing the error.
    20 threads:
    for (int i = 0; i < 20; i++) {
    try{
    extrThreads[i] = new Thread(this);
    extrThreads.start();
    }catch (Exception e) {
    System.out.println(e);
    21st Thread:
    public void processdata()throws Exception{
    Thread t = new Thread(this);
    t.start();
    if(t!= null)
    t.join();
    funtion();
    This thread is throwing the error

  • Changing the minimum window size in Calendar

    I keep two programs open side by side on one of my "Desktops." They fit next to each other side by side and filled the entire screen. iCal was one of those applications. Since upgrading to Mountain Lion, the default minimum window size appears to be larger than it was in Lion. Now Calendar.app obscures part of the other application on this desktop.
    I've searched around on the internet for hours looking for a way to modify the minimum window size to restore the "side by side" configuration, but I have not been able to find anything.
    Does anyone have any advice on how to tackle this?
    Don

    I just upgraded to mountain lion.  I cannot reduce the size of ical to fit with mail on my 15" macbook pro.  In checking around, the new calendar does not allow us to size the window as we want.  This is a big miss for apple.  we need to be able to size windows as we see fit.  also, in lion, and now mountain lion, we only have the option of the stupid fake-leather looking calendar.  We should have options for this, too.
    Please let me know if there is a fix for sizing the ical window as we previously had in lion.  Apple, if you are listening, go for simplicity and flexibility.  Let us decide window sizes, look, and anything else.
    thank you
    john

  • To increase the framerate of a Basler Cameralink Camera(A504K) with a Card Grabber PCIE-1429

    Hi,
    I am using a monochrome Basler Cameralink Camera(A504K)of resolution 1280x1024 with a card grabber PCIE-1429 (x4 slot). The image acquisition is controlled through MAX  of LabVIEW version 11.0.1. The problem is that when I try to reduce the number of rows(more specifically Height) from 1024 to 32(say)in the acquisition window(of MAX), the frame rate of the camera should increase almost upto 16,000fps. But it is not going beyond 248fps. Can you suggest  me, why is it so happening, Or How to increase its frame rate? Also, below the image window there appeared something like: 1280x32    1X   8-bit image  9. What does 1X actually mean here?For your ready reference I am also attaching the image of the acquisation window.
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    snap1.PNG ‏78 KB

    Hi Anto,
    things are more complicated in my case. The computer I/O and/or speed of the HDD do no let me to save large stream of frames at desired frame rate. Therefore, I do following:
    1) send each frame into the queue; I had to reduce frame size to 720x512 instead of full resolution
    2) since I have 8 cores on that machine, I created 4 tasks which do only one thing: take a frame from the queue and save it into the disk as fast as possible with no image processing
    3) saving on the HDD is an issue, so each of 4 tasks save frames into the virtual 24Gb drive instead of the real HDD. Even SSD drive will not help you!
    4) note, frames are saved in an uncompressed BMP format! If you attempt to save them as jpg then your CPU will spend crucial 2-10ms for compressing it.
    With this implementation and camera (with specs of only 340fps) I managed to grab frames with peak 735fps rate. My point is that your bottleneck probably lies not in the method you use/call to save the frames, but in computer hardware and I/O. You have to accumulate frames in RAM or virtual drive and then save them without processing.
    I still have some frame loses, it is approximately 1-2% of the frames are lost. I do not know why.  Some notes:
    1)      to achieve as less as possible frame loss you have to minimize information you output on UI in real-time.
    2)      Utilize multitasking!
    3)      Put highest priority for your VI (check settings in properties)
    4)      In theory the 64bit should perform a bit better than 32bit LabView, in my experience it is in opposite. I run 32bit LabView on 64bit Windows7 machine. This is strange…
    5)      Unfortunately 32bit LV has limitation on RAM allocation (4Gb only) otherwise I would store all captured frames in RAM (32Gb) avoiding even usage of the virtual drive. I use 24Gb virtual drive. It is enough for me to capture frames for about 1-1.5 minutes @735fps.
    6)      If you need any kind of real-time image processing (which I would like to have) then probably you need to purchase FPGA card and program it.
    Actually, seem that LabView and VDM modules do not utilize computer hardware optimally. I would like to use the power of all cores and even GPU. The GPU can encode and process images, but LV has limited support of it.
    The best option for lossless capturing, at least for me, is to find the time and write a C++ code which will do the job.
    regards,
     Alexander

  • How can I increase the number of pixels in an image?

    How can I increase the number of pixels in an image?

    You can't.
    The number of pixels in an image is decided by the camera that shoots the image
    With an app like Photoshop you can interpolate - this will make a guess as to what a particular pixel may look like based on the ones around it. Results can vary wildly and Photoshop is expensive.
    Regards
    TD

  • I'm picking up all of the data script related to the sending / receipt of an e-mail along with the e-mail itself and can't find a way of not showing the text. Obviusly only a command but can't find it!

    I'm picking up all of the data script related to the sending / receipt of an e-mail along with the e-mail itself and can't find a way of not showing the text. Obviusly only a command but can't find it! Help!

    Shift-Command-H is the key-combo to switch 'Long Header'/'Standard Header' .
    Long way: Top Menu -> View -> E-Mail
    Stefan

  • When i open .jpg picture in photoshop on MAC the the background thumbnail in the layers panel looks like a white box with the brush inside instead of picture thumbnail. how to fix it?

    when i open .jpg picture in photoshop on MAC the the background thumbnail in the layers panel looks like a white box with the brush inside instead of picture thumbnail. how to fix it?

    Very easy. That means you have a "no layer thumbnails" option selected.
    Go into the Layers Panel menu at the upper right of the Panel, choose Panel Options and you will see Thumbnail sizes to choose from.
    Select one, click OK.
    Gene

  • I downloader all the Adobe Presenter, looks like everything downloaded but when I open the program I get the following message: The file archive part of Presenter is missing. You need all parts in the same folder

    I downloadedall the Adobe Presenter, looks like everything downloaded but when I open the program I get the following message: The file archive part of Presenter is missing. You need all parts in the same folder

    HI There,
    It seems that Presenter is not fully downloaded. Please check you have downloaded .exe and .7z files successfully. In case you are still facing the issue then please click on the following link to chat with the support :  Chat
    with an Expert
    Regards,
    Mayank

  • When I restart my Mac, the grey screen appears like usual. But it takes more than 40 minutes (more) for it to load to finish restarting the Mac. What should I do?!

    When I restart my Mac, the grey screen appears like usual. But it takes more than 40 minutes (or more) for it to load to finish restarting the Mac. What should I do to fix it?!

    Disconnect all devices from your computer if you have not already done so.  Restart again.  If the problem has been resolved, you had a peripheral conflict.  You will then have to reconnect the devices one at time, restart,  to locate the culprit.
    Login Items is another culprit.  Check your login items.
    System Preferences>Accounts>Login Items
    Delete/disable all you do not need or want.

Maybe you are looking for