Autor Beitrag
lestatconcorde
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mi 16.04.03 21:28 
Hi

Hab mir nen kleines Delphi Programm geschrieben
das einen haufen Jpg Bilder durchnummeriert und auf meinem
Webserver verschiebt

soweit sogut


Ich muss allerdings vorher unbedingt sichergehen das die JPGs
nicht kaputt sind.

( Der Webserver erstellt später automatisch aus den Bildern passende Thumbsnails per PHP Script - Ist allerdings eines der Bilder kaputt
hängt sich der ganze Webserver mit 100% CPU Auslastung weg. :cry: )

Ich müsste also mit Delphi jedes Image vorher kurz einlesen und checken ob alles Ok ist - aber wie kann ich das ?

TImage und TJPEGImage laden jedes noch so kaputte Bild ohne Fehler bzw. Rückmeldung...
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Do 17.04.03 13:57 
Hier eine Funktion, mit der das geht:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
...
uses jpeg;

...
function JPEGTest(image: TFilename):boolean;
var img:TJPEGImage;
begin
  result:=true;
  img:=TJPEGImage.Create;
  try
    img.LoadFromFile(image);
  except
    result:=false;
  end;
  img.Free;
end;


Wie du Sie aufrufen musst, solltest du wissen. Gruß Onz
arcardia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Fr 18.04.03 12:05 
Hi

Hab das gleiche Problem
Aber wie bereits lestat oben geschrieben hat lädt selbst das TJpegImage
so ziemlich jedes kaputte Image ohne problems.

Angeblich steht im Header des JPG BIldes drin wie gross dieses letztendlich in Bytes ist - habs allerdings nicht gefunden wo und überhaupt...
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Fr 18.04.03 12:06 
Die FUnktion die Ich geschrieben hab geht.
arcardia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Fr 18.04.03 15:05 
Sorry aber....

Zumindest mit Delphi 7 wird das Bild trotzdem fehlerfrei geladen,
es wird keinerlei exception ausgelöst und die funktion meldet ein OK.

Das Bild das ich zum Testen verwendet habe ist 78 kb gross , per Hex-Editor hab ich das Bild um ca 10 kb am Ende gekürzt.
Daraufhin ist in der Bildvorschau von WinXP im unteren 1/5 des Bildes nur noch Datenmüll zu sehen und die PHPISapi.dll des Webservers hängt sich beim Versuch das Bild zu laden auf.

Die JPGTest function kann das bild ohne problem laden und sogar per assign in einer TImage Kompo darstellen (auch dort ist der "Datenmüll" am Ende des Bildes eindeutig zu sehen)
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Fr 18.04.03 17:22 
Schickst du mir das kaputte Bild mal per Mail bitte?
Ich habe einem Bild einfach mit dem Editor ein paar Zeichen ausgeschnitten und gespeichert. Unter Delphi 6 hat die Funktion das gemeldet.
Wie gesagt, schick mir das Bild mal, das du kaputt gemacht hast.:
Mo@onz24.de
Zaubär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 99



BeitragVerfasst: Fr 18.04.03 18:28 
Warum machst du nicht eine Prozedur, die jedes Bild lädt und neu schreibt(JPEG -> Bitmap -> JPEG). Dadurch ist dann vielleicht etwas Blödsinn zu sehen, aber das Bild wäre dann nicht mehr defekt
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Fr 18.04.03 18:29 
Wäre ne Idee.
Schaus mir mal an.
arcardia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Fr 18.04.03 19:31 
mmhhhhh :?

Durch das neuschreiben der jpeg's hätte ich aber gleichzeitig nen erstklassigen Qualitätsverlust...