Image dimensions metadata on google-cloud-storage. - image

I need to know the dimensions of images I'm saving, so that I can add them to the og:image:width and og:image:height meta tags for image previewing by Facebook, Twitter etc - as is suggested by this Facebook documentation.
If I'm saving these images to a google storage bucket - is there any already existing way of finding these images sizes with existing standard metadata, or will I need to add some custom metadata as described in this google documentation?

Given that Cloud Storage sees everything as objects, it does not have multiple object definitions, depending on the type of the object (like media, text... it does something like this via Content-Type but it's not what you're looking for). In this sense, there are no object type characteristic-metadata (i.e. width and height of images or length for sounds or videos).
The only predefined (or how you call it, standard) metadata entries are the ones mentioned here and, yes, as you specified, you need to add custom metadata.

Related

Liquid Pixels check source image mime type

unfortunately, I cannot tag this post with the correct "technology" because it does not exist and i dont have 1500 reputation to create it.
We are using a cloud service called "Liquid Pixels" to render some stuff on our images.
Lets say we have an image chain that is currently rendering a ribbon on the given JPEG image. This chain is working fine.
Then I adapted the chain to work with animated gif images, therefore I changed the sink format to gif (sink=format[gif]). That was working fine as well.
Now I want to combine the two cases in one chain, because the only difference is the sink command. The plan is to check the MIME type of the source image and then either render a gif or a jpg image.
I rendered the image as xml to view the metadata map.
I thought i can do it like this.
source=url[https://something.com/1x1_sample.gif],name[testImage]
sink=format[gif],if[('testImage.format' eq 'GIF')]
sink=format[jpg],if[('testImage.format' ne 'GIF’)]
But for some reason I cannot access the format attribute. I am used to grab some parameters like “testImage.width” or “testImage.height”, but for some reason i cannot access the format=“GIF” property. I guess that has happens because the width and height are on a different hierarchy level in the metadata map.
I hope you guys can help me.
The image does not actually have a "format" during the render. Only a file has a format. During processing the image is simply on memory as either raster or vector data; it is only when you sink that it becomes a file in whatever format. Also, LiquiFire OS uses the image data to determine the original format when acquiring an image from a source, never the image name itself.
If you need operations in your LiquiFire Image Chain to react to the source image URL, you can test the last part of the image name by applying a regular expression to see if it is either .GIF or .gif. An example of how that can be done:
set=imageURL[https://your.server.com/sample.gif]
source=url[global.imageURL],name[testImage]
regexcase=name[isGif],key[global.imageURL],cases[\.gif$|\.GIF$|\.\w+$],values[yes|yes|no]
sink=format[gif],if[('global.isGif' eq 'yes')]
sink=format[jpg],if[('global.isGif' eq 'no’)]

Why would I need image placeholder service or library?

Yesterday, I saw a tweet saying about holderJS library. When I read the usage, it says it will generate the image placeholder completely on client side. So I am wondering why in the life would I need a placeholder library?
What is the scenario in which rather than placing div of some size I would use image placeholder?
Image placeholders are generally meant for a page that is either in the process of dynamically loading a real image or the page is only partially designed and the placeholder image shows how the design will be laid out and how big the image should be even though the real image is not yet available. In this way, the HTML design can be nearly completed even though the final images are not yet available or done.
Wikipedia uses image placeholders when they know they want a particular image in a page, but are in search of an image they can use with the appropriate license.
Image placeholders are traditionally served up by a service on the web that automatically creates the placeholder images based on query parameters in a URL, but the holder.js library creates placeholder images entirely on the client (so no outside services are needed).
You can certainly achieve the same look as a placeholder with just a div with a background color and perhaps even some text in the div. But, when someone wanted to plug the final images into place, they would have the change the div tags to img tags. When using a placeholder image, all the HTML tags can be final and left as they are, only the .src values need to be plugged in to finish the design. So, placeholder images allow you to have a closer to complete version of the HTML even though the images are not yet done. It's a minor different, but one that is appreciated by some designers.

Programmatically generate animated gifs that show up properly on Twitter posts?

I am able to utilize imagemagick to properly generate animated images and I can post them to twitter without issue, however upon posting them, it seems as though Twitter is somehow destroying the animation component I'm guessing with it's reencoding of the image.
This is less than desirable in my situation as I need to post a statistical compilation of images daily to an account and need the animation to retain integrity. I am supposing that this is a function of Photobucket that they're now using or such.
How does one encode an image and upload it such that it retains its integrity? I have wondered about uploading directly to TwitPic or other options or perhaps exploring more fully the imagemagick encoding options so that they line up precisely with Twitter requirements in order to produce an image that requires no reencoding, however I'm looking for help in this regard.

MediaWiki API: size at which images where embedded/dropping unrelated icons

I use the MediaWiki API to find images of Wikipedia articles. However, I also get all the useless icons, like the broom for when a article needs to be cleaned up or the creative commons logo that marks something to be placed under a creative commons license.
Is there a way to detect which images are such icons so I can drop them? E.g. is there a way to query the size at which the image was embedded (rather then the size of the original image, which might be huge even for icons) so that I can drop all small ones. I'm not really interested in very small images anyway.
As far as I know, no. That information is simply not stored in the database, and is therefore also not available via the API.
Some things you could perhaps do include:
Load the HTML markup of the article (via the API action=parse, or simply via index.php with action=render) and extract the image sizes from it.
Simply build a list of images that should be excluded. You could do this programmatically (e.g. find all images used on all templates included in Category:Wikipedia maintenance templates and all its subcategories) or just add any unwanted images to the exclusion list as you come across them.

Storing an NSImage in a Core Data Model

What is the correct way to store an NSImage in a Core Data Model? I have assumed adding an Attribute to an Entity and giving it the Type "Binary" should work, but it is not working. I have a table with a column of NSImageCells and it is not showing anything.
If you can work in 10.5+, the easiest way is to store the NSImageReps for the image in "Transformable" attribute. By default, the transformable attributes use NSCoding to archive their values on set and unarchive on access. This saves you from having to write custom getters/setters. If you want to get fancy, you could write a custom NSValueTransformer that converts an image to an acrhived version of its representations and visa versa on get. If you're using 10.4, then you have to write custom getters/setters (see Apple's docs on creating Non-standard persistent attributes. You can get the image's image reps by sending the NSImage a -representations message.
If you want to display the images in a UI via bindings, you should also read the Displaying Images Using Bindings section of the Cocoa Bindings Programming Topics.
This doesn't answer the exact question you asked, but depending on how many images you are storing it can be more efficient to store only paths or URLs to the images, saved in your own location, and load them as required.
You'll need to create an NSData representation of it.
Have a look at Non-Standard Persistent Attributes. Especially the section under Transformable Attributes, and Custom Code if that doesn't sort you out.
Here is a really easy implementation
http://objectivesheep.com/blog/nsimage_coredata/

Resources