I have a similar issue. I am loading photo of a person into StackPane/ImageView from a file. At this time the image looks like original. Upon Save button being clicked, the image is inserted in database BLOB field. In SQL, when you view this, the image appears perfectly normal. On View / Modify options, I retrieve the Blob and convert it to Image and load it in the same Imageview. But now it appears with a reddish Background.
This is the correct image at the time of loading from file
But this is how it appears when I display it from Database
I did this to my CSS file and it works.
.scrollPane.disabled {
-fx-opacity: 1.0;
-fx-background-color: cornsilk;
}
.scrollPane {
-fx-opacity: 1.0;
-fx-background-color: cornsilk;
}
This is the order of my nodes.
Scroll Pane
Stack Pane
Image View
Image
Related
I'm using the
Item.grabToImage()
But I'm getting the following error.
QML ItemX: grabToImage: item has invalid dimensions
This is because I'm using height and width properties like so:
width: {
// return with * 0.4; based for some condition
// for eg
return parent.width * 0.4;
}
// and something similar with height
The only time that I can get the following code working is when I put in a static heigth and width:
grabToImage(
function(result)
{
result.saveToFile("/path/project-name/tmp/something.png");
}
);
Any ideas of why and how do I get around this problem?
Thank you
I'm not a 100% sure why, But it was something about the dynamic width of the parent.
In the program I wrote I has set the anchors of the image to the left and right of the preview container.
So when I tried to get the image capture from another item that was overlaying the image to cut out smaller parts of the image it was not letting me.
How I fixed this was to set a fixed image size of the source image and then just anchor it to the center of the preview section.
The only thing is now it will not size up if you scale the window.
I'm sure I could implement and on size change to the main program window and then set the width of the image (Not tested).
Last thing I should mention is that if the image is small then the cut out images from sections of the source image will be blurry and not good quality.
I fixed this by setting the "sourceSize.width" to a very large image and then used the "scale" property to scale down the image to fit within the preview item.
I'm using easeljs in order to control my CANVAS.
And I'm trying to make animation by changing images, but not using spritesheet.
But whenever images are changed there is time lag( like blinking)...
How can I remove blinking not using spritesheet?
My guess (until you provide code), is that the image is being loaded during this gap, that's why you see a blink, and this is because you are loading the image in the same container (meaning the place where the image is loaded/displayed).
The solution to this is to use 2 containers, one in the top of the other; you have the first image loaded, and when you load the next image, you set a complete event on that second image, and when the second image loads, you remove the first one.
In the end you will have to create a class to manage both images and their events, this because if you are trying i.e. creating an image rotator, you will have to swap the bottom image loaded to the top, to make a smooth transition, and/or to add an alpha tween.
This is a very simple outline:
Container
topImage
bottomImage
this.addChild(topImage)
this.addChild(bottomImage)
bottomImage.on("complete", function(){
//add effect to top image (fade out)
//load image into top image
//fadein effect
})
topImage.on("complete", function(){
//first time you have to add an fade in
//but you can remove the event after that
})
this.load = function(path){
bottomImage.load(path)
}
Okay this solution seems to not be findable.
I have a border type image on stage (circular) and I am dynamically loading an image from xml in my document class. I have a place holder image inside the border. Can I replace that image with the one that is dynamically loaded?
Or do I have to addChild and then scale and transform it all through code?
I would just remove the place holder image and add the new image into the same container and scale/position it. It is simple to do with code.
container.removeChild(placeHolderImage);
container.addChild(newLoadedImage);
newLoadedImage.scaleX = newLoadedImage.scaleY = 1.5;
newLoadedImage.x = 100;
newLoadedImage.y = 100;
You can possibly draw into the bitmap data of the image already on screen but I don't see any downsides with just removing the old one and adding the new image.
I have worked for Image binding for listbox. For that I have binded the Image Url to Image Source. My proplem is someURL not valid does not contain image. Normally I have loaded defalut image for no url contains items.
That not valid url, binded the image as empty pixel. In this i want to show default image. If no pixel in image means, binding not needed.
string Url="Some URl.jpg";
Binded this "URL" to the Image.
Pls Help me
For this try to give a background image in your image content which is equal dimensions of ur image content..by default it shows the background image when no image in the URL.
Use Stackpanel at background, so when image is loading , it will show by default color of stackpanel, and when image is loaded it will show Image, thereby hiding the background color
StackPanel background = new StackPanel();
background.Background = new SolidColorBrush(Colors.LightGray);
Image img1 = new Image();
img1.Height = 250;
img1.Stretch = Stretch.UniformToFill;
LowProfileImageLoader.SetUriSource(img1, new Uri(n.Image, UriKind.RelativeOrAbsolute));
background.Children.Add(img1);
I want to resize product images before upload them by using values through text boxes.
eg:
user browse image and then give width(px) in one text and height(px) in another textbox click on apply and now this size is apply on image.
then user upload image.
can any one tell me or guide me to resource so i can get this functionality.
i already added both text box with button on product image upload grid.
What is the point? Magento spares you from any of that fooling around with images. You upload them in whatever size you want hen it creates and caches the sizes it needs on the fly. What your trying to achieve is a leap backwards.
Please use this code to resize your image
$imageUrl = "http://localhost/";
$imageResized = Mage::getBaseDir('media').DS."catalog/category/resized";
$imageObj = new Varien_Image($imageUrl);
$imageObj->constrainOnly(TRUE);
$imageObj->keepAspectRatio(TRUE);
$imageObj->keepFrame(false);
$imageObj->keepTransparency(True);
$imageObj->setImageBackgroundColor(false);
$imageObj->backgroundColor(false);
$imageObj->quality(100);
$imageObj->setWatermarkImageOpacity(0);
$imageObj->resize(120, 120);
$imageObj->save($imageResized);
I think you have to look at this controller.
Mage_Adminhtml_Catalog_Product_GalleryController
You will need to rewrite this controller. Some how make the width and height values arrive to the action. And than apply re-sizing to the image.
HTH