Gstreamer get image width and height - png

I have a simple gstreamer pipeline which looks like :
| Filesrc | --> | PngDec | --> | ImageFreeze | --> | Queue | --> | Compositor | --> | Fake Sink |
location (input) of the filesrc is a png file of size 400 X 600.
In the pipeline how do I get the width and height of the file? (400 X 600)

Related

How to convert text-based table to image from terminal in the same structure?

I'm trying to convert text-based table to the image, but the structure is broken after convertation.
I have file with the next structure:
+-----------+------+------------+-----------------+
| City name | Area | Population | Annual Rainfall |
+-----------+------+------------+-----------------+
| Adelaide | 1295 | 1158259 | 600.5 |
| Brisbane | 5905 | 1857594 | 1146.4 |
| Darwin | 112 | 120900 | 1714.7 |
| Hobart | 1357 | 205556 | 619.5 |
| Sydney | 2058 | 4336374 | 1214.8 |
| Melbourne | 1566 | 3806092 | 646.9 |
| Perth | 5386 | 1554769 | 869.4 |
+-----------+------+------------+-----------------+%
after a conversation with ImageMagick and command below:
convert label:"$(cat test.txt)" result1.png
I have next image:
As you can see, the structure of the columns is broken.
Do you have an idea of how can such an issue be solved?
Regards,
Ihor
You need to set the TypeFace to something monospace to match the terminal.
convert -font "Liberation-Mono" label:#test.txt result1.png
You can identify which fonts on the system by running
identify -list font | grep Mono

pdf manipulation - tagging image or figure

I have a source pdf(untagged.pdf) out of which I would be creating a tagged version(tagged.pdf)
I have information of all the html tags of all contents of the source pdf.
Now I have a figure on page 3. When I programmatically parse, this will not be detected as an image but this is a rectangle with some text and another rectangle like below.
_____________________ ____________________
| Some text inside | ----> | Some other text |
| | ----> | Inside |
|_____________________| ----> |____________________|
Fig 1.x Rectangle 1 to Rectangle 2
Using some other techniques, I have detected this is a figure and bounding coordinates of the same. Lets say the bounding coordinates is [10, 30] and [100, 60], I want to tag the whole thing as a figure(like below)
_____________________________________________________________(100, 60)
| |
| _____________________ ____________________ |
| | Some text inside | ----> | Some other text | |
| | | ----> | Inside | |
| |_____________________| ----> |____________________| |
| |
| Fig 1.x Rectangle 1 to Rectangle 2 |
|_____________________________________________________________|
(10, 30)
Now I want to tag this the entire section as an image. I have checked libraries like itextpdf or pdfbox. They dont have APIs to tag a figure using coordinates.
In other words, are there any ways to tag an element(group of images) as a figure programmatically.

Scrollview Scrolling with dynamic images on them and vertical/horizontal scrolling but one at a time

I am able to achieve horizontal scrolling with dynamic addition of images on them, with infinite scrolling and lazy loading of images as well.
Actually, I am kind of stuck, about how to proceed with vertical scrolling of image in regards to horizontal image being displayed.
For Eg: I pull down some images from server, those are random pics, and those pics are associated to some albums of a user on my server.
So, when user scrolls left to right (horizontal) then scrollview should display all the downloaded bunch of images, but when user scroll up/down then scrollview should display other images associated to album of current image (from horizontal mode). Say I downloaded image 1,2,3 and 4. and When I scroll up/down then say for index 2, it should display 2.1, 2.2 etc which is nothing but linked to the album.
I have the json with me for both vertical and horizontal screens. however, I am not sure how to modify my current flow (infinite scrolling+lazy load) with albums kinda view.
Thanks for the help.
Create vertical ScrollViews inside your horizontal ScrollView. Each vertical ScrollView represents an album. Fill all images in that album to this vertical ScrollView. Set direction lock to yes for all ScrollViews. The whole structure should like below.
------------- -------------
| | | |
| ------- | | ------- | > Vertical ScrollViews
| | | | | | | | with images inside
| | | | | | | |
| | | | | | | |
| | | | | | | |
| ------- | | ------- |
| | | |
-------------------------------------------------------------------------------
| | | | | |
| | ------- | | ------- | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | Horizontal ScrollView |
| | | | | | | | | with vertical Scrolls |
| | ------- | | ------- | |
| | | | | |
| ------------- ------------- |
-------------------------------------------------------------------------------
For solve this issue you have to create touch method for horizontal scroll and according to touch update the vertical scroll Scrollview data.If you need then I also post some tips of code.
if(CGRectContainsPoint([imgView frame], [touch locationInView:scrollView]))
{
[self ShowDetailView:imgView];
break;
}
}
}
-(void)ShowDetailView:(UIImageView *)imgView
{
selectOther_ImageView.image = imgView.image;
}

Cannot read (or find?) ResourceBundle

Below is my project structure.
Project
|
|--src
| |
| |--com
| | |
| | |--jasper
| | |
| | |--JasperDemo.java
| |
| |--i18n.properties
|
|
|--Arabic.jrxml
In the properties file there is a key text1.paragraph and it's value may be in any language(most preferable arabic).
In the .jrxml file I have set ResourceBundle="i18n" and in the textfield have used $R{text1.paragraph}
Now the problem is that when I run it from eclipse in the PDF file I get output of the field as $R{text1.paragraph} not it's value

Animating a UIImage or UIImageView?

I'm trying to animate an image's height (from height of 0 pixels to 480 pixels) to create the effect of the image being rendered top-down.
With an UIImageView i noticed that it appears correct in the Interface Builder. But when it runs in the simulator the size (width and height) is always set to whatever the size of the image is; meaning, if I set the height of the image view to be 50% the original height, the image is still rendered in full height.
I also tried do this effect with an UIImage. However, although the size of the image appears correct, the image is scaled to reflect the size/aspect-ratio.
Question:
How can i achieve this dynamic sizing (i.e. animation of an image's size) while NOT scaling the image? I thought about using CGImageCreateWithMask, but im pretty sure that would create huge performance hiccups.
* Update *
The effect that im looking for is this:
Animate an image by making it grow in height, from to-down (like a set of blinds being pulled on a window). This image cannot be scaled (as it would lose the visual effect of looking like a "blind"). This image must also be rendered on top of another image. So there are 2 images total.
* ANSWER *
For the top-most imageview, i set the content mode to Top (so it doesnt scale). Then in code, i set the clipsToBounds to True. Now i am able to animate the top-most imageview height thus giving me the effect i am looking for.
Use an animation block like so:
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 0)];
imageView.image = ...;
[imageView setClipsToBounds:YES];
[imageView setContentMode:UIViewContentModeTop];
[self.view addSubview:imageView];
[imageView release];
[UIView animateWithDuration:4.0f
delay:1.0f
options:UIViewAnimationOptionCurveEaseIn
animations:^(void) {
imageView.frame = CGRectMake(0, 0, 320, 480);
}
completion:NULL];
You may want to check out Animation Blocks. They're documented quite thoroughly here:
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html
All the code there is relevant, because UIImageView is a subclass of UIView.
Happy coding.
Just a suggestion, assume you have two images: A and X (the X-ray image):
+-------+ +-------+
| | | |
| | | |
| A | | X |
| | | |
| | | |
+-------+ +-------+
Dynamically you can create a one-pixel high image (temp), copy the content from X partially, put it on top of A:
+-------+ +-------+ +-------+
| | | temp1 | < | |
| | +-------+ | |
| A | | X |
| | | |
| | | |
+-------+ +-------+
In a loop, dynamically create/resize the temp image, and copy more content from X:
+-------+ +-------+ +-------+
| | | temp2 | < | |
| | | | | |
| A | +-------+ | X |
| | | |
| | | |
+-------+ +-------+
+-------+ +-------+ +-------+
| | | temp3 | < | |
| | | | | |
| A | | | | X |
| | +-------+ | |
| | | |
+-------+ +-------+
+-------+ +-------+ +-------+
| | | temp4 | < | |
| | | | | |
| A | | | | X |
| | | | | |
| | +-------+ | |
+-------+ +-------+
+-------+ +-------+ +-------+
| | | tempX | < | |
| | | | | |
| A | | | | X |
| | | | | |
| | | | | |
+-------+ +-------+ +-------+
As mentioned in the original post, here is the answer i seem to have stumbled upon:
For the top-most imageview, i set the content mode to Top (so it doesnt scale). Then in code, i set the clipsToBounds to True. Now i am able to animate the top-most imageview height thus giving me the effect i am looking for.
Try set your UIImageView's contentMode property to one of the following value. I think what you need is UIViewContentModeScaleAspectFit:
typedef enum {
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped.
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
UIViewContentModeCenter, // contents remain same size. positioned adjusted.
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
} UIViewContentMode;
You should have a look on Flip Clock for iPad tutorial. It is with core animation, hence has a performance bonus.