2013-03-13 62 views
1

C#.net我有下面的代碼中,我沒有得到的含義:相關圖片

double savesize = (8.0 * ((height * (width/3) * 3)/3 - 1))/1024; 

所以,請幫助我。

代碼:

private void ImageBrowseButton_Click(object sender, EventArgs e) 
    { 
     DialogResult dr = openFileDialog1.ShowDialog(); 
     if (dr == DialogResult.OK) 
     { 
      loadedImagePath = openFileDialog1.FileName; 
      imageTextBox.Text= loadedImagePath; 
      loadedImage = Image.FromFile(loadedImagePath); 
      height = loadedImage.Height; 
      width = loadedImage.Width; 
      loadedBitmap = new Bitmap(loadedImage); 

      FileInfo imginf = new FileInfo(loadedImagePath); 
      float size = (float)imginf.Length/1024; 
      SizeLabel.Text = size.ToString() + " KB"; 
      HeightLabel.Text = loadedImage.Height.ToString() + " Pixel"; 
      WidthLabel.Text = loadedImage.Width.ToString() + " Pixel"; 
      double savesize = (8.0 * ((height * (width/3) * 3)/3 - 1))/1024; 
      SaveSizeLabel.Text = savesize.ToString() + " KB"; 
     } 

    } 

謝謝

回答

0

這是保存圖像所需的千字節數的估計。要保存爲位圖(無損)式將是(從Zicara)以千字節

文件大小=每 樣品分辨率2 x寬度x高度x位÷8192

在您的例子,我假定圖像不是作爲位圖保存的,而是以有損格式生成這些尺寸的文件,並給出這些尺寸的圖像 - 查看如何實際保留這些文件可能會使更多的光線脫落。

+0

@ user2166457,沒問題。如果此答案足夠,請將其標記爲已接受。謝謝 –