mercredi 1 avril 2015

Why is saving a picture twice in a row producing different binary in Paint

I thought this was a little odd. Open Paint on Windows (I'm using Windows 7) and draw something (anything). Then save as a .png for example called 1.png. Then save 'n' number of other copies straight away without modifying the image (2.png, 3.png,..etc).


I notice that 1.png has a different checksum to 2/3/4/../n.png. 1.png also varies in such (sometimes smaller and other times bigger) compared to the other images.


What is going on?


showing pictures in python

hey real python noobie here. I'm trying to open pictures but in the bad way. can anyone tell my how to show pictures in program without using popups or not vanila modules. or pygame my python version is 2.7.


thanks!


Container, Image and Text: How to get it working together?

Well, I have a Container, an Image and some Texts (inside another container), this way:



<RelativeLayout height="wrap_content">
<ImageView height="fill_parent"/>
<LinearLayout>
<TextView/>
<TextView/>
</LinearLayout>
<RelativeLayout/>


The image associated with ImageView (yes, it is a background image) is bigger than the height of all text together. Thus, I would like to "crop" it inside RelativeLayout. But that ImageView always take full size when I set it to fill_parent. :(


What can I do?


P.S.: I already tried to use that image as background of RelativeLayout. Not working also.


Pleaaase, help!!


How do I get an image to display in google script?

I am working on a script for someone, and while I have the text part of it down, He also wants the logo to appear above the text in the email. Here is my code:



function myFunction(e) {
var userResponse1 = e.values[1];
var userResponse2 = e.values[2];
var userResponse3 = e.values[3];
var userResponse4 = e.values[4];
var userResponse5 = e.values[5];
var userResponse6 = e.values[6];
var subject = "LOC - Declaration Confirmation";
var userEmail = e.values[7];
/**var a = this.createElement("img");
a.src = "http://ift.tt/1HLoGDW";**/
var message = "Band Name: " + userResponse1 + "\n" + "Class: " + userResponse2 + "\n" + "Performance Time: " + userResponse3 + "\n" +
"Comment only groups: " + userResponse4 + "\n" + "Absences or other information: " + userResponse5 + "\n" + "Your name: " + userResponse6;

MailApp.sendEmail(userEmail, subject, message);


Thanks in advance


How to improve the processing of images in cpp?

I have ~1000 images (640x640) from a x-ray-ct scan, and each of the images represent a slice of my scanned object. Now I wanted to create a 3d-model out of these images (as already described here). For that I wanted to put all of the image data into a 3d-matrix, where the x- and y-coordinate gives the colour of a picture at this point, while the z-coordinate is the image number. I created the following algorithm:



//Read all images
QPixmap tmpImg;
QImage tmpImgMap;
QPair<int, int> pos;
pixel Pixel;
QString imagePos;
QPair<int, QVector<pixel> > image;
QColor colour;
for(int i = 0; i < newProcess->images.size(); i++)
{
tmpImg.load(newProcess->images[i]);
tmpImgMap = tmpImg.toImage();
imagePos = newProcess->images[i];
imagePos.remove("img/USB_proc");
imagePos.remove(".png");
int position = imagePos.toInt();
image.first = position;
image.second.clear();
for(int j = 0; j < tmpImgMap.width(); j++)
{

for(int h = 0; h < tmpImgMap.height(); h++)
{
pos = qMakePair(j, h);
Pixel = qMakePair(pos, true);
colour = QColor::fromRgb(Pixel.second);
if(colour.blue() + colour.red() + colour.green() != 0)
{
image.second.push_back(Pixel);
ui->readNumber->setText(QString::number(this->images.size()));
}
else
{
Pixel = qMakePair(pos, false);
image.second.push_back(Pixel);
}
}
}
this->images.push_back(image);
}
ui->readNumber->setText(QString::number(this->images.size()));
ui->lineEdit->setText("Länge des images-arrays ist: " + QString::number(this->images.size()));
qSort(this->images.begin(), this->images.end(), sortImages);
ui->readNumber->setText("Sorted!");


with the earlier defined variables newProcess->images as a vector containing the path to the images and this->images as QVector<QPair<int, QVector<pixel> > > images. pixel has been defined as typedef QPair<QPair<int, int>, bool> pixel.

The idea behind the algorithm is: Go through all images, get all pixels, look up the colour, if it is black, then store false, else true (done for speed and storage). Store in a pixel-value the colour and the position of one pixel, and put them together (after finishing the loop over all pixels in one image) into a image-vector. This image-vector is finally saved in this->images.

My problem is: This algorithm is extremely slow, one image takes around one second. Furthermore it needs processing afterwards to get it into a 3d-matrix. How can I improve the speed of this algorithm (and preferably get the original colour back, i.e. that I don't have to use bool-values, but QRgb-Values instead?


Why I can't see this immages using img tag in FireFox?

I am not so confident with HTML and CSS and I have the following problem.


Into a table I have something like this:



<td style="border-bottom: 1px solid #76818a !important; width: 10px; text-align: center; padding: 0 !important;">

<div style="width: 90px;">

<img alt="su" src="img\freccia_up.gif"
onclick="Javascript: spostaSu();"> <br>

<img
alt="giu" src="img\freccia_down.gif"
onclick="Javascript: spostaGiu();"> <br> <br> <br>

<img alt="nascondi" src="img\freccia_dx.gif"
onclick="Javascript: eliminaColonna()"> <br> <img
alt="visualizza" src="img\freccia_sn.gif"
onclick="Javascript: aggiungiColonna()">

</div>

</td>


As you can see it show some .gif immages stored into the img path of my project.


The problem is that using Explorer and Chrom it works fine (these immages are correctly showd into the page) but using FireFox the immages are not rendered and instead these immages it is showed the value of the related alt attribute of the tag.


Why I have this behavior? What can I do to try to solve and correctly show these immages also using FireFox?


Tnx


how to make the drowing be visible under colors in android studio?

I'm making an android app for kids and it has drawing in it to be colored by children , however it seems that the painting disappear enter image description here under colors and i can't find a reason for that although my canvas is transparent .