Sulu: Is it possible to get a resized image with custom meassures without a image format - sulu

is it in sulu possoble to get a resized image on the fly with custom dimensions, without the need to define an image fomrat before? A kind of "dynamic image format".
Reason is, that I would like to define multiple versions of an image based on some code calculations in order to fill the srcset attribute of an image.
Thx a lot!
Andreas

Not by default, but you might be able to override some parts of the FormatManager, but I am sure you would break some of Sulu's functionality that way (e.g. purging the cache for all image formats probably won't work anymore, or you can't manually crop that non-existing format). However, I have also not tested it, and I am not sure if that really works :-/

Related

I want to store the characters in image. swift

I want to store the text in image.
I want to store text inside the image.
Is this possible? For example, the image contains various information such as location information.
I like to store my text inside the images like them.
I want to store the string inside the data of the image rather than the visual.
For example, you might want to store a small string that identifies the image in the image, so you want to separate it when you import the image.
I want to implement it in swift.
Your Q still leaks of information, what you really want to do. But I'll try to give you an answer, which might be a step to a better Q.
If you are talking about "inside" the image, you might mean inside the pixel data itself. It is possible to add data to an image without changing the image for humans. This is called a digital watermark or fingerprint. Typically this is used for DRM. You will find some information about this by using a search machine like Qwant.
But I do not think, that you really want to do this. Likely you want to add information in an image file. First of all you need a file format supporting additional data. Tiff is an example. AFAIK there is no build-in facility to get partial TIFF data for the image with ability to add private tasks. You have to create the file your own.

AlamofireImage: Is it possible to get the raw data from an NSimageview in Swift?

I am using an imagewell to accept jpg images being pasted or dragged into my OSX app. The problme is that I am struggling to get the original jpg images as OSX seems to requires me to get the Tiff version of the NSImage if I want to uplod via Alamo Fire.
Does AlamoFireImage have a fancy way of getting the original url / original raw data without converting to Tiff first?
Actually, with an NSImageWell, you don't have much possibilities regarding the dropped image. It's a convenient class for showing dropped images but as soon as you need to do more, it's not up to the task.
I suggest you use an NSImageView instead, and add drag and drop capabilities to it like in my example here: https://stackoverflow.com/a/29233824/2227743
This way you can easily get the dropped image's URL (and filename), and the image data itself of course.

imageview empty after going out of app

I've created some code to display a image in a imageview when the current image is equal to a certain imageview. It works correctly but If I decide to go out of the app and then back in it somehow doesn't see the current image and the comparison doesn't work anymore.
if (imageview25.image == [UIImage imageNamed:#"BLUEBOXPUNT.png"]){
key25.hidden = NO;
}
So this works but when I leave app and come back in it doesn't see that the image is equal to BLUEBOXPUNT.png
Is there a other way to do this or to do something like in Java I would do imageview25.getImage. I think that would work.
Your comparison logic is checking whether two image objects have the same address. This will only work while the image remains in cache. It's likely that a memory warning will cause the same problem you see when switching apps.
If you want to associate images and their file names, I think you'll need to do it yourself, possibly with a dictionary that is keyed to the names.
If you need to show more than one image. An easier way is to use more than one UIImageView, all are the same size and at the same place. But each show a different image. Then you can show the one you need and hide others(or bringSubviewToFront).
If you indeed need to compare two image:
Cocoa Touch - Comparing Images
OpenCV

Image manipulation tool on my website

I would like to ask if anyone knows a software that can be modified and used on my website. I need a tool that will be able to add multiple images resize and move theme. Something like THIS but with multiple images support...
Beside that I need a canvas to be fix (width, height, dpi...) So the produced image will always have the same specifications...
Thanks for your answer!
nothing beats http://www.imagemagick.org/script/index.php

Performing iPhone optimization on externally downloaded PNGs

When a PNG is added to an XCode iPhone project, the compiler optimizes it using pngcrush. Once on the device, the image's rendering performance is very fast.
My problem is that my application downloads its PNGs from an external source at runtime (from Picasa Web albums, using the Google Data APIs). Unfortunately, these images' performance is quite bad. When I do custom rendering on top of the image, it seems 100x slower than its internally stored counterparts. I strongly suspect this is because the downloaded images haven't been optimized.
Does anyone know how I can optimize an externally downloaded PNG at runtime on the iPhone? I'm hoping for a class that does this. I even considered adding pngcrush's source code to my app, which seems drastic. I haven't been able to find an decent answer myself. I'd be very grateful for any help.
Thanks!
Update:
Some folks have suggested that it may be due to the file's size, but it isn't. During my tests, I added a toggle button to switch between using the embedded version and the downloaded version of exactly the same PNG. The only difference is that the embedded one was optimized by 'pngcrush' during compilation. This does some byte-swapping (from RGBA to BRGA) and pre-multiplication of alpha. (http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html)
Also, the performance I'm referring to isn't the downloading, but the rendering. I superimpose custom painting on top of the image (overriding the drawRect method of the UIView), and it's very choppy when the background is the downloaded version, and very smooth when it's the embedded (and therefore optimized) version. Again, it's exactly the same file. The only difference is the optimization, which I'm hoping I can perform on the image at runtime, on the device, after downloading it.
Thanks again for everyone's help!
That link you posted pretty much answers your question.
During the build process XCode pre-processes your png so it's in a format that's more friendly to the graphics chip in the iPhone.
Png's that have not been processed like this will likely use a slower rendering path, one that deals with the non-native format and the fact that the alpha must be computed separately for each color.
So you have two options;
Perform the same work that pngcrush does and swap ordering/pre-multiply alpha. The speed up may be due to one or both of these.
After you have loaded your image, you can "create" a new image from it. This new image should be in the iPhone's native format and so should perform faster. The downside is it could potentially take up a bit more memory.
E.g.
CGRect area = CGRectMake(0, 0, width, height);
CGSize size = area.size;
UIGraphicsBeginImageContext(size);
[oldImage drawInRect:area];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
The fact that you say it "seems" 100x slower indicates that you have not performed any experimentation, but made a guess (it must be the PNG optimization), and are now going down a path based on a hunch.
You should spend time to confirm what the problem is before you try to solve it. My gut says that PNG optimization shouldn't be the issue: that mostly affects the loading of images, but once they are in memory it doesn't matter what file format they were originally in.
Anyway, you should try an A-B comparison, either get your code to load an optimized PNG from somewhere else and see how it compares, or make a test app that just does some drawing on the two PNG types. Once you've confirmed what the problem is, then you can figure out if you need to compile pngcrush into your app.
On the surface, it sounds like something else is at play here. Any additional image manipulation should only add time until it's displayed onscreen...
Would it be at all possible to get the server to gzip the images by sending the appropriate HTTP header? (If it even helps file size much, that is.)
Temporarily using the pngcrush source might be a good test as well, just to get some measurements.
Are you storing the png at the original downloaded size? If it's a large image it'll take significantly longer to render.
Well it seems that a good way to do it (since you can't run pngcrush on the iPhone and expect that to speed it up) would be to make your requests through a proxy that runs pngcrush. The proxy would have nice horse power to actually give you some gain over the 100x pain you feel.
try pincrush to trans the normal png file to the crushed png file
You say you are drawing on top of the image by overriding a UIView's drawRect: method. Are you trying to do some animation by repeatedly drawing the whole image with your custom stuff on top of it?
You might get better results if you put your custom stuff in a separate view or layer, and let the OS deal with compositing the result over the background. The OS will only update the parts of the screen that you actually change, and won't be repainting the entire image as often.