How to Resize an Image in Photoshop CS5 & CS6

Let’s say you have an image which you want to change the size of. In most cases, you want to make the image smaller, but resizing an image to be larger can also be done. In Photoshop, the steps are very easy:

  1. Open the image (File > Open…)
  2. Click Image > Image Size…
  3. In the section called “Pixel Dimensions,” enter a new value for Width or Height. The drop down boxes allow to you to specify if the values will be in Pixels or Percent. So, for example, if you want to resize the image by half, pick “Percent” and type in “50” for Width & Height.
  4. There will be a checkbox near the bottom called “Constrain Proportions.” This will lock with width and height to maintain the same ratio as the original image. Generally you want this checked so that your image will not distort or appear “stretched.” If unchecked, you can change width & height independently to any value.

That’s it! Now you can re-save the image. The method described above works in previous versions of Photoshop too, such as CS5 and earlier.

List of All Temple Run Powerups & Costs

Temple Run is a fun game for Android & iOS. Here is a list of all the powerups that can be unlocked in the game, along with the cost in coins to unlock them:

Mega Coin:
250: Enable the 50 Coin powerup.
1000: Increase Mega Coin to 75 coins.
2500: Increase Mega Coin to 100 coins.
5000: Increase Mega Coin to 125 coins.
7500: Increase Mega Coin to 150 coins.
25000: Allow disabling Mega Coin.

Coin Magnet:
250: Enable the Coin Magnet powerup.
1000: Make Coin Magnet last longer.
2500: Coin Magnet doubles coin value.
5000: Make Coin Magnet last longer.
7500: Coin Magnet triples coin value.
25000: Allow disabling Coin Magnet.

250: Enable the Invisibility powerup.
2500: Make Invisibility last longer.
5000: Make Invisibility last longer.
7500: Make Invisibility last longer.
25000: Allow disabling Invisibility.

Speed Boost:
250: Enable the 250m Boost powerup.
1000: Increase Boost to 375m.
2500: Increase Boost to 500m.
5000: Increase Boost to 625m.
7500: Increase Boost to 750m.
25000: Allow disabling Boost.

250: Double Value coins after 1500m.
1000: Double Value coins after 1000m.
2500: Triple Value coins after 3000m.
5000: Triple Value coins after 2500m.
7500: Triple Value coins after 2000m.

How to Make a Borderless Subplot of Images in MATLAB

Let’s say that you have a set of images that you want to tile using imshow() and subplot() in a MATLAB figure. By default, both functions add a padded space around the images to separate them, as this example shows:

I1 = zeros(500,'uint8');
I2 = zeros(500,'uint8')+127;
I3 = zeros(500,'uint8')+255;

subplot(1,3,1), imshow(I1);
subplot(1,3,2), imshow(I2);
subplot(1,3,3), imshow(I3);


However, what if you want to tile the images without any space between them? The imshow() function does have a property to remove the border around a displayed image, by using imshow(I, 'border', 'tight'). This is fine when only one image is being displayed, but subplot() itself adds additional spacing between images. Removing this space is not straightforward, but a gap-less subplot grid can be constructed by using the following function in place of subplot():

function h = subplottight(n,m,i)
    [c,r] = ind2sub([m n], i);
    ax = subplot('Position', [(c-1)/m, 1-(r)/n, 1/m, 1/n])
    if(nargout > 0)
      h = ax;

By using this function, a completely borderless subplot of images can be constructed as follows:

I1 = zeros(500,'uint8');
I2 = zeros(500,'uint8')+127;
I3 = zeros(500,'uint8')+255;

subplottight(1,3,1), imshow(I1, 'border', 'tight');
subplottight(1,3,2), imshow(I2, 'border', 'tight');
subplottight(1,3,3), imshow(I3, 'border', 'tight');


How to Add the arg max and arg min Functions to Lyx

The arg max and arg min functions are not standard as math functions in LaTeX. As a result, they are not straightforward to use in Lyx either. However, it is quite simple to do so:

  1. Add the following code to the LaTeX preamble in Lyx (Document > Settings > LaTeX Preamble):
  2. When you create a new math field in Lyx, simply type \argmax or \argmin. You can follow it by an underscore if you need text below the arg max or arg min functions. This text will be centered across all six letters.

It’s that simple!

How to Use a New Latex Class in Lyx

Let’s say we have a custom new Latex class called “newclass.cls” which we want to be able to use with Lyx under Windows.

  1. Copy the new Latex class file “newclass.cls” into the MikTeX directory within your user settings folder like so: C:\Users\UserName\AppData\Roaming\MiKTeX\2.8\tex\latex\newclass\newclass.cls. Remember to replace UserName with your own Windows user name.
  2. Update the MikTeX list of classes by clicking the Windows Start button and typing cmd into the search box. When the black command line window displays, type texhash and hit Enter.
  3. Next we need to create a layout file for Lyx to work with. This file contains instructions on how to roughly format a document when displayed within the Lyx program itself. More importantly, the layout file points to the Latex class for generating the final output. It is helpful to start by just modifying an existing layout file which is similar in purpose to the Latex class we are trying to add. For example, if our new Latex class is a template for an article, we might want to start by copying article.layout from C:\Program Files (x86)\LyX20\Resources\layouts and pasting it into C:\Users\UserName\AppData\Roaming\LyX2.0\layouts. Rename the file to match your class name, say, “newclass.layout”
  4. Open up your new layout file, and look at the second line. Replace it with:
    # \DeclareLaTeXClass[newclass]{Title of Class}
    Enter your class name within the [] brackets, and enter whatever descriptive name you want to call the class within the {} braces.
  5. Open Lyx, and click Tools > Reconfigure. Restart the Lyx program when it prompts you to do so.

That’s it! When you start a new document in Lyx, your new class should appear within the drop-down box for Document Class in the Document Settings window (Document > Settings).

Tested with Lyx 2.0 and MikTeX 2.8 under Windows 7.