Set relative image size Paperclip [Rails] - paperclip

Is it posible to set a relative size to a image with paperclip?
Does exists something like this?
:medium => "50x50%"

see following links I think it would help you
watch resize option
https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation
and following link examples are there
http://www.imagemagick.org/Usage/resize
http://www.imagemagick.org/Usage/resize/#percent
Thanks.

Related

Why is flutter not showing image on Android device

I have setup image assets like this:
/assets/images/img1.png
/assets/images/2.0x/img1.png
/assets/images/3.0x/img1.png
/assets/images/2.0x/img2.png
/assets/images/3.0x/img2.png
Then Image.asset('assets/images/img1.png') is displayed, but Image.asset('assets/images/img2.png') is not.
in pubspec.yaml assets defined like this:
assets:
- assets/images/
My question is do I have to add the /assets/images/img2.png ?
If yes, then why? because the device is not 1x resolution. Probably 2x or 3x.
You are missing asset for /assets/images/img2.png
Just resize img2.png by 50% and put img2.png in /assets/images/
Could you please tell us what are you trying to achieve maybe you just need to add one image and using in a boxDecoration in a Container but if you add to you question what exactly want to do, our answer its gonna help you more.

Loading an image from a subdirectory in a gem

I used bundler to create a new gem, and I'm playing with rubygame. So far, it's going OK, except I can't get images on the Surface because I can't figure out what the path is to my images directory. I know it's sad, but I'm sorta used to Rails loading my images for me.
The full path to the image is: /usr/local/src/jewel_thief/lib/jewel_thief/images/player.png.
and I'm trying to use it in:
/usr/local/src/jewel_thief/lib/jewel_thief/player.rb (view source)
What am I doing wrong?
Change
#image = Surface.load 'jewel_thief/images/player.png'
To
#image = Surface.load '/jewel_thief/images/player.png'
I think following also work
#image = Surface.load '/jewel_thief/lib/jewel_thief/images/player.png'
The path ended up being this:
#image = Surface.load 'lib/jewel_thief/images/player.png'
Finally, after being stumped for hours. Thanks for the help though! Really.

image() modifies actual image content in MATLAB

I am displaying an image in figure window in MATLAB using following code.
im = imread('Image02.tif');
processAndDisplayImage(im);
hImage = image(im);
set(hImage,'ButtonDownFcn',#clickInImage);
But problem is that the third line above makes the image changed for some reason I don't know. Is there any way to get image handle without the modification?
UPDATE: Resolved the problem. Please refer to my answer below.
The image graphical command cannot change the image. I can only guess that it shows the image in a way you don't want it. Inspect the range of the image -
max(im(:));
and also the type:
class(im);
and try to figure out what is wrong
Perhaps you could modify processAndDisplayImage so that it returns a handle to the displayed image as an output variable?
Instead of
hImage = image(im);
I used following to solve my problem.
[hImage hfig ha] = imhandles(gcf);
But I still don't understand image command does to the actual image displayed on figure.

HTML5 Move Image Along Path

I'm trying to move a png or gif along a predetermined path inside a <canvas> element. Can anyone provide a few resources or code samples to get me started?
Thanks in advance!
You may want to look at this link: https://developer.mozilla.org/En/Canvas_tutorial:Basic_animations for more information, but basically your best bet is to erase the canvas, then redraw everything having moved the image, which you drew with 'drawImage'.
The x,y coordinates will change based on your path.

How to display pictures in the project resource?

I have a set of small icons and hope to display them in my application when certain condition occurs, for example on sunny day, I display the sunny icon.
I can add the jpg files in the picture, and they seem to be uploaded to phone when I deploy the app. However, I don't know how to access these jpgs in my program.
Could someone help? Thanks a lot!
Check this post about content and resources: http://www.windowsphonegeek.com/tips/wp7-working-with-images-content-vs-resource-build-action
To summarize: You should mark your images with a Build Action of Content or Resource, preferably Content. Now you can reference the Content from your Xaml or in code.
If the Build Action for your image resources is set to Content, then you just specify the Source property for the Image control to the relative path to your images:
this._image.Source = new BitmapImage(
new Uri("/Images/myImage.jpg", UriKind.Relative"));
You can display pictures using the Image element:
<Image Source="/MyImage.png" Visibility="Visible"/>
If you want to switch images according to conditions then you can create multiple images and change each of their Visibility states - or (more preferable) you can create a single image element and change its Source.
Quite how you do this depends on whether you are using databinding or working directly with the UIElements in code behind.

Resources