Yorumları: 10
Konuları: 1
Kayıt Tarihi: 03-02-2022
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 4 Başlangıç
Delphi programında jpeg resimleri kaydettirdiğim klasöre standart 1500x1125 çözünürlüğünde yaptırabilirmiyim acaba.Yardımcı olurmusunuz
Yorumları: 1.034
Konuları: 31
Kayıt Tarihi: 22-07-2016
Aktif Kullandığınız Delphi Sürümü:
- Delphi 13
- Delphi 12
- Delphi 11
- Delphi 10 Serisi
Rep Puanı: 5.303 Üstad
1- Yeni bir uygulama oluşturun.
2- Formun üzerine birer adet button, image ve OpenDialog yerleştirin.
3- Image Stretch özelliğini True yapın (isteğe bağlı, resmi çerçeve sığdıracaktır).
4- Aşağıdaki metod ile bir resim seçin.
5- Resmi seçtiğiniz anda seçtiğiniz dizine 1500x1125 ebadında yeni bir jpg resmi üretecektir.
procedure TForm1.Button1Click(Sender: TObject);
const
imgW = 1500;
imgH = 1125;
var
imgBMP: TBitmap;
imgJPG: TJPEGImage;
Uyumsuz: boolean;
imgBoyut: Double;
posSolUst, posUst, posSagAlt, posAlt: integer;
strYol: String;
begin
if OpenDialog1.Execute then
begin
imgJPG := TJPEGImage.Create;
Uyumsuz := false;
try
imgJPG.LoadFromFile(OpenDialog1.FileName);
if (imgJPG.Height >= imgJPG.Width) AND (imgH <= imgJPG.Height) then
begin
imgBoyut := imgW / imgJPG.Height;
end
else if (imgJPG.Height <= imgJPG.Width) AND (imgW <= imgJPG.Width) then
begin
imgBoyut := imgH / imgJPG.Width;
end
else
begin
Uyumsuz := true;
end;
imgBMP := TBitmap.Create;
try
imgBMP.SetSize(imgW, imgH);
if not Uyumsuz then
begin
posSolUst := (imgW - Round(imgJPG.Width * imgBoyut)) div 2;
posUst := (imgH - Round(imgJPG.Height * imgBoyut)) div 2;
posSagAlt := Round(imgJPG.Width * imgBoyut) + posSolUst;
posAlt := Round(imgJPG.Height * imgBoyut) + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end
else
begin
posSolUst := (imgW - imgJPG.Width) div 2;
posUst := (imgH - imgJPG.Height) div 2;
posSagAlt := imgJPG.Width + posSolUst;
posAlt := imgJPG.Height + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end;
Image1.Picture.Assign(imgBMP);
imgJPG.Assign(imgBMP);
imgJPG.SaveToFile(Format('%s_%sx%s.jpg', [OpenDialog1.FileName, imgW.ToString, imgH.ToString]));
finally
imgBMP.free;
end;
finally
imgJPG.free;
end;
end;
end;
Not: Uses bölümüne Vcl.Imaging.jpeg ekleyin.
Begin : = end / 2;
Yorumları: 274
Konuları: 18
Kayıt Tarihi: 11-10-2016
Rep Puanı: 1.312 Programcı
@ RAD Coder hocamız Delphi çözümünü verdiği için ekliyorum yoksa yazmayacaktım, bu ve benzeri (tırnak içinde söylüyorum) "angarya" işlemleri hep Python'a yaptırırım
from PIL import Image
image = Image.open('image.jpg')
new_image = image.resize((1500, 1125))
new_image.save('resize_image.jpg')
Pillow kütüphanesi dışında OpenCV (cv2) de var tabi.
Yorumları: 1.034
Konuları: 31
Kayıt Tarihi: 22-07-2016
Aktif Kullandığınız Delphi Sürümü:
- Delphi 13
- Delphi 12
- Delphi 11
- Delphi 10 Serisi
Rep Puanı: 5.303 Üstad
FMX tarafında bu iş daha da kolay; tek satırda çözülüyor.
imgBMP.Resize(1500, 1125);
Begin : = end / 2;
Yorumları: 10
Konuları: 1
Kayıt Tarihi: 03-02-2022
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 4 Başlangıç
09-02-2022, Saat: 14:01
(Son Düzenleme: 09-02-2022, Saat: 14:02, Düzenleyen: Blacklord.)
(09-02-2022, Saat: 13:41)RAD Coder Adlı Kullanıcıdan Alıntı: 1- Yeni bir uygulama oluşturun.
2- Formun üzerine birer adet button, image ve OpenDialog yerleştirin.
3- Image Stretch özelliğini True yapın (isteğe bağlı, resmi çerçeve sığdıracaktır).
4- Aşağıdaki metod ile bir resim seçin.
5- Resmi seçtiğiniz anda seçtiğiniz dizine 1500x1125 ebadında yeni bir jpg resmi üretecektir.
procedure TForm1.Button1Click(Sender: TObject);
const
imgW = 1500;
imgH = 1125;
var
imgBMP: TBitmap;
imgJPG: TJPEGImage;
Uyumsuz: boolean;
imgBoyut: Double;
posSolUst, posUst, posSagAlt, posAlt: integer;
strYol: String;
begin
if OpenDialog1.Execute then
begin
imgJPG := TJPEGImage.Create;
Uyumsuz := false;
try
imgJPG.LoadFromFile(OpenDialog1.FileName);
if (imgJPG.Height >= imgJPG.Width) AND (imgH <= imgJPG.Height) then
begin
imgBoyut := imgW / imgJPG.Height;
end
else if (imgJPG.Height <= imgJPG.Width) AND (imgW <= imgJPG.Width) then
begin
imgBoyut := imgH / imgJPG.Width;
end
else
begin
Uyumsuz := true;
end;
imgBMP := TBitmap.Create;
try
imgBMP.SetSize(imgW, imgH);
if not Uyumsuz then
begin
posSolUst := (imgW - Round(imgJPG.Width * imgBoyut)) div 2;
posUst := (imgH - Round(imgJPG.Height * imgBoyut)) div 2;
posSagAlt := Round(imgJPG.Width * imgBoyut) + posSolUst;
posAlt := Round(imgJPG.Height * imgBoyut) + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end
else
begin
posSolUst := (imgW - imgJPG.Width) div 2;
posUst := (imgH - imgJPG.Height) div 2;
posSagAlt := imgJPG.Width + posSolUst;
posAlt := imgJPG.Height + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end;
Image1.Picture.Assign(imgBMP);
imgJPG.Assign(imgBMP);
imgJPG.SaveToFile(Format('%s_%sx%s.jpg', [OpenDialog1.FileName, imgW.ToString, imgH.ToString]));
finally
imgBMP.free;
end;
finally
imgJPG.free;
end;
end;
end;
Not: Uses bölümüne Vcl.Imaging.jpeg ekleyin.
Tşk ederim hocam
(09-02-2022, Saat: 13:49)Hayati Adlı Kullanıcıdan Alıntı: @RAD Coder hocamız Delphi çözümünü verdiği için ekliyorum yoksa yazmayacaktım, bu ve benzeri (tırnak içinde söylüyorum) "angarya" işlemleri hep Python'a yaptırırım
from PIL import Image
image = Image.open('image.jpg')
new_image = image.resize((1500, 1125))
new_image.save('resize_image.jpg')
Pillow kütüphanesi dışında OpenCV (cv2) de var tabi.
tşk ederim.
Yorumları: 274
Konuları: 18
Kayıt Tarihi: 11-10-2016
Rep Puanı: 1.312 Programcı
(09-02-2022, Saat: 14:00)RAD Coder Adlı Kullanıcıdan Alıntı: FMX tarafında bu iş daha da kolay; tek satırda çözülüyor.
imgBMP.Resize(1500, 1125);
Delphime laf söyletmem diyorsunuz yani
Yorumları: 1.034
Konuları: 31
Kayıt Tarihi: 22-07-2016
Aktif Kullandığınız Delphi Sürümü:
- Delphi 13
- Delphi 12
- Delphi 11
- Delphi 10 Serisi
Rep Puanı: 5.303 Üstad
(09-02-2022, Saat: 14:14)Hayati Adlı Kullanıcıdan Alıntı: (09-02-2022, Saat: 14:00)RAD Coder Adlı Kullanıcıdan Alıntı: FMX tarafında bu iş daha da kolay; tek satırda çözülüyor.
imgBMP.Resize(1500, 1125);
Delphime laf söyletmem diyorsunuz yani 
Yani!
Onlar çoğu metodu Delphi gibi köklü ve güvenilir dillerden klonluyor.
Begin : = end / 2;
Yorumları: 10
Konuları: 1
Kayıt Tarihi: 03-02-2022
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 4 Başlangıç
09-02-2022, Saat: 14:28
(Son Düzenleme: 09-02-2022, Saat: 15:19, Düzenleyen: Blacklord.)
(09-02-2022, Saat: 13:41)RAD Coder Adlı Kullanıcıdan Alıntı: 1- Yeni bir uygulama oluşturun.
2- Formun üzerine birer adet button, image ve OpenDialog yerleştirin.
3- Image Stretch özelliğini True yapın (isteğe bağlı, resmi çerçeve sığdıracaktır).
4- Aşağıdaki metod ile bir resim seçin.
5- Resmi seçtiğiniz anda seçtiğiniz dizine 1500x1125 ebadında yeni bir jpg resmi üretecektir.
procedure TForm1.Button1Click(Sender: TObject);
const
imgW = 1500;
imgH = 1125;
var
imgBMP: TBitmap;
imgJPG: TJPEGImage;
Uyumsuz: boolean;
imgBoyut: Double;
posSolUst, posUst, posSagAlt, posAlt: integer;
strYol: String;
begin
if OpenDialog1.Execute then
begin
imgJPG := TJPEGImage.Create;
Uyumsuz := false;
try
imgJPG.LoadFromFile(OpenDialog1.FileName);
if (imgJPG.Height >= imgJPG.Width) AND (imgH <= imgJPG.Height) then
begin
imgBoyut := imgW / imgJPG.Height;
end
else if (imgJPG.Height <= imgJPG.Width) AND (imgW <= imgJPG.Width) then
begin
imgBoyut := imgH / imgJPG.Width;
end
else
begin
Uyumsuz := true;
end;
imgBMP := TBitmap.Create;
try
imgBMP.SetSize(imgW, imgH);
if not Uyumsuz then
begin
posSolUst := (imgW - Round(imgJPG.Width * imgBoyut)) div 2;
posUst := (imgH - Round(imgJPG.Height * imgBoyut)) div 2;
posSagAlt := Round(imgJPG.Width * imgBoyut) + posSolUst;
posAlt := Round(imgJPG.Height * imgBoyut) + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end
else
begin
posSolUst := (imgW - imgJPG.Width) div 2;
posUst := (imgH - imgJPG.Height) div 2;
posSagAlt := imgJPG.Width + posSolUst;
posAlt := imgJPG.Height + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end;
Image1.Picture.Assign(imgBMP);
imgJPG.Assign(imgBMP);
imgJPG.SaveToFile(Format('%s_%sx%s.jpg', [OpenDialog1.FileName, imgW.ToString, imgH.ToString]));
finally
imgBMP.free;
end;
finally
imgJPG.free;
end;
end;
end;
Not: Uses bölümüne Vcl.Imaging.jpeg ekleyin.
hocam componetini alabilirmiyim
Hocam delphi 7 kullanıyorum component sorunu var
Yorumları: 1.034
Konuları: 31
Kayıt Tarihi: 22-07-2016
Aktif Kullandığınız Delphi Sürümü:
- Delphi 13
- Delphi 12
- Delphi 11
- Delphi 10 Serisi
Rep Puanı: 5.303 Üstad
(09-02-2022, Saat: 14:28)Blacklord Adlı Kullanıcıdan Alıntı: (09-02-2022, Saat: 13:41)RAD Coder Adlı Kullanıcıdan Alıntı: 1- Yeni bir uygulama oluşturun.
2- Formun üzerine birer adet button, image ve OpenDialog yerleştirin.
3- Image Stretch özelliğini True yapın (isteğe bağlı, resmi çerçeve sığdıracaktır).
4- Aşağıdaki metod ile bir resim seçin.
5- Resmi seçtiğiniz anda seçtiğiniz dizine 1500x1125 ebadında yeni bir jpg resmi üretecektir.
procedure TForm1.Button1Click(Sender: TObject);
const
imgW = 1500;
imgH = 1125;
var
imgBMP: TBitmap;
imgJPG: TJPEGImage;
Uyumsuz: boolean;
imgBoyut: Double;
posSolUst, posUst, posSagAlt, posAlt: integer;
strYol: String;
begin
if OpenDialog1.Execute then
begin
imgJPG := TJPEGImage.Create;
Uyumsuz := false;
try
imgJPG.LoadFromFile(OpenDialog1.FileName);
if (imgJPG.Height >= imgJPG.Width) AND (imgH <= imgJPG.Height) then
begin
imgBoyut := imgW / imgJPG.Height;
end
else if (imgJPG.Height <= imgJPG.Width) AND (imgW <= imgJPG.Width) then
begin
imgBoyut := imgH / imgJPG.Width;
end
else
begin
Uyumsuz := true;
end;
imgBMP := TBitmap.Create;
try
imgBMP.SetSize(imgW, imgH);
if not Uyumsuz then
begin
posSolUst := (imgW - Round(imgJPG.Width * imgBoyut)) div 2;
posUst := (imgH - Round(imgJPG.Height * imgBoyut)) div 2;
posSagAlt := Round(imgJPG.Width * imgBoyut) + posSolUst;
posAlt := Round(imgJPG.Height * imgBoyut) + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end
else
begin
posSolUst := (imgW - imgJPG.Width) div 2;
posUst := (imgH - imgJPG.Height) div 2;
posSagAlt := imgJPG.Width + posSolUst;
posAlt := imgJPG.Height + posUst;
imgBMP.Canvas.StretchDraw(Rect(posSolUst, posUst, posSagAlt, posAlt), imgJPG);
end;
Image1.Picture.Assign(imgBMP);
imgJPG.Assign(imgBMP);
imgJPG.SaveToFile(Format('%s_%sx%s.jpg', [OpenDialog1.FileName, imgW.ToString, imgH.ToString]));
finally
imgBMP.free;
end;
finally
imgJPG.free;
end;
end;
end;
Not: Uses bölümüne Vcl.Imaging.jpeg ekleyin.
hocam componetini alabilirmiyim
Hocam delphi 7 kullanıyorum component sorunu var
Component Kullanmadım.
Delphi 11 ile test ettim.
Begin : = end / 2;
Yorumları: 10
Konuları: 1
Kayıt Tarihi: 03-02-2022
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 4 Başlangıç
(09-02-2022, Saat: 15:28)RAD Coder Adlı Kullanıcıdan Alıntı: (09-02-2022, Saat: 14:28)Blacklord Adlı Kullanıcıdan Alıntı: hocam componetini alabilirmiyim
Hocam delphi 7 kullanıyorum component sorunu var
Component Kullanmadım.
Delphi 11 ile test ettim.
delphi 7 kullanıyorum hocam component için yardım
|