Is there any way to use one thumb as the source of another? - paperclip

I need paperclip to create pictures for iphone4 and iphone5. iphone4 is a bit smaller, so my declaration looks looks like this:
has_attached_file :picture, styles: {
iphone5: '640×1136>',
iphone4: '640×960#'
}, default_url: :get_default_url
The idea behind this was, I want the iphone4 thumb just exactly like the iphone5 one, but crop it after scaling, but this doesnt work, because the original gets cropped.
So how can I solve this? This seems such a common problem for me, I also think I have seen something like declaring the iphone4 input should be the iphone5 thumb and not the original, but I haven't found a solution.

I could solve it now with just two sizes with the uploaded image forced to have the same dimensions as the iphone 5. The declaration of the attachment looks like this:
has_attached_file :profile_photo, styles: {
iphone5: '640×1136>',
iphone4: '',
}, convert_options: {iphone4: "-gravity south -thumbnail 640x960^ -extent 640x960"},
default_url: :set_default_url_for_profile_photo

Related

How would I go about swapping different transparent images with others in visual basic 6?

So I have a programming project that I have to do for my school. What I have to do is setup a 2 player dice game. I could have gone the easy way and just display the number of the 2 die, but I was thinking of using images that I made in photoshop instead. However, the problem is that I do not know how to change images in an efficient way.
My first option is using the visibility tag on several images laid on top of eachother and change it accordingly as such
image1.visible = false
image2.visible = true
However, I do not think that is very efficient. Images also do not support changing the image with code from my research.
Secondly, I could use a PictureBox instead, which do support changing the image as the program is running. However, it does not support transparency, and the die images are transparent. Plus it gives me the invalid image file error, I guess due to the transparency in the gif files.
There is also the cheap workaround of me making the background of the images the same as the form background.
So is there a more efficient way I am missing out? I know that the cheap workaround would be the best option for this case, but I would like to have this knowledge for future use like semi-transparent pixels that blend in and such.
And before you ask, no, I cannot use another programming language as visual basic 6 is what my school teaches. Thankfully they are changing it soon, but I am stuck with this for now.
Turns out you CAN change the pictures of Images, while keeping transparency and stretch. I am going to properly show it:
Image1.Picture = LoadPicture("YOURPATHHERE.gif")
This is what I get for believing what I've seen on some forum.
Also, the error of invalid image file was due to the images being corrupted for some reason.

Working with Images in Xamarin App programmig

I am working on a Xamarin App compatible with all devices. I have a general question related to images. I am using Location Mark Image Icons to provide locations available on the Map. My issue is, Image has a white background which is also showing along with its background. I want to show only the Image.
Is this related to the designer to provide the image without background? Or as a developer, I can do something on it.
Xamarin.Forms doesn't delete your white background. What you need to do is following a small tutorial on how to use Adobe Photoshop for example and export your images as png, you might even consider which png type you need, there's 3 types of png:
png8
png24
png32
I won't be going deep in explaining each one of them, but you need to know that they all support transparency and could have a transparent background, however, you might notice some differences between them on the edges.
For example, png8 will give a small white border while png24 will not show that.
You can check this for example: https://helpx.adobe.com/photoshop-elements/using/optimizing-images-png-24-format.html
No, you can't do anything about it using Xamarin.Forms. You need to modify the image and remove the background (using Adobe Photoshop, etc.) and make sure to save it as .png.
If its simple white background you want to remove, You can utilise simple [MakeTransparent][1] method ofBitMap.
But this will remove all white coloured pixel. So IF your logo also contains white color, better you contact your designer.

Automatically color balance images

Is there a way in Ruby to automatically color-balance images that are uploaded to my Ruby on Rails app?
It seems like a lot of the images I'm uploading are too dark and I'd like to normalize all my images to be equally bright if possible, rather than simply making every image brighter. If some image is sufficiently bright, it should not be changed.
I would use rmagick. Take a look at the modulate method, perhaps that would help.

Drawing large images for ipad

I am developing an application for viewing images.
I used the example of PhotoScroller Apple to implement this application.
In my application I want to be able to draw on the image.
I had the idea to put a UIView on top with transparent background and draw the lines via touch events. This solution has become very slow because the generated images are very large, around 3700x2000 pixels.
I also tried a solution with the example of Apple GLPaint that uses OpenGL, but it has a size limitation of 2048x2048 pixels.
Anyone have any idea or example of how I implement this?
I think you should try and tile your image.
One option is using CATiledLayer. Have a look at this short tutorial.
Or you could try and use CGContextDrawTiledImage to get your stuff done. Possibly this post from S.O. could help you getting started.

iPhone images display

I want to know if there is any way to append something like white border around iPad image thumbnails without too much performance issues?
Something like in XHTML\CSS where you get Polaroid like appearance.I think you may have got faint idea.
Any guidance is highly appreciated.
Fastest way would be to draw a frame around your images if they're all of the same size (your thumbnails).

Resources