ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Cannot create file ...The system cannot find the path specified
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

brm121966

USA
30 Posts

Posted - Jul 20 2022 :  21:59:52  Show Profile  Reply
Hi.

I am trying to save the file ImageEnView1.IO.SaveToFile(OutputFilename, ioPNG);

OutputFilename := "\\As6204t-e169\MAIN\MUSIC\Jazz\Ben Webster\Ben Webster with strings MUSIC FOR LOVING 2 CD#1103;s + Folders mp3pro.320kB\Folder.png";

The string contains the character (see image).

I get an error. Cannot create file "\\As6204t-e169\MAIN\MUSIC\Jazz\Ben Webster\Ben Webster with strings MUSIC FOR LOVING 2 CD#1103;s + Folders mp3pro.320kB\Folder.png". The system cannot find the path specified

If you remove the character, the procedure saves the file. Is there a way to fix it without fixing the file path?

Thanks.





Rudolf

xequte

7079 Posts

Posted - Jul 21 2022 :  03:16:24  Show Profile  Reply
Hi Rudolf

If you put a unicode string value inside quotes in Delphi it will use the literal value of that, i.e. #1103;

So you need to move it outside the quotes:

OutputFilename := '\\As6204t-e169\MAIN\MUSIC\Jazz\Ben Webster\Ben Webster with strings MUSIC FOR LOVING 2 CD'#1103's + Folders mp3pro.320kB\Folder.png';


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

brm121966

USA
30 Posts

Posted - Jul 21 2022 :  22:05:42  Show Profile  Reply
Hi Nigel.
I'm sorry, but this doesn't work.
Cannot create file "\\As6204t-e169\MAIN\MUSIC\Jazz\Ben Webster\Ben Webster with strings MUSIC FOR LOVING 2 CD'#1103's + Folders mp3pro.320kB\Folder.png". The system cannot find the path specified.
The characters #1103 appeared after inserting a line into a post in this forum. Part of the real line in the picture of the previous message.
What's the problem, any ideas?
Thank you.


Rudolf
Go to Top of Page

xequte

7079 Posts

Posted - Jul 21 2022 :  22:50:56  Show Profile  Reply
Hi Rudolf

If you copy the path to a TEdit at runtime, I assume it displays correctly (with the reversed R).

Then if you click a button using this code:

ImageEnView1.IO.LoadFromFile( edit1.Text );

Does it load correctly?

What version of Delphi are you using?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

brm121966

USA
30 Posts

Posted - Jul 22 2022 :  18:05:05  Show Profile  Reply
Hi Nigel.
Did as you advise.
Read property edit.text, ImageEnView1.IO.Params.FileName.
These properties are equal to the LoadFromFile parameter.
The file is loading correctly.
Then I change the filename and convert the size and palette of the file.
An error occurs while writing the file.
I use Delphi XE5


Rudolf
Go to Top of Page

xequte

7079 Posts

Posted - Jul 23 2022 :  00:26:04  Show Profile  Reply
Hi Rudolf

Please give me some steps to reproduce the issue here.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

brm121966

USA
30 Posts

Posted - Jul 24 2022 :  09:35:37  Show Profile  Reply
Hi Nigel.

function Convert_Image(InputFilename: string): boolean;
var
  w, h: integer;
  OutputFilename: string;
  ImageEnView1 : TImageEnView;
begin
  result := false;

  ImageEnView1 := TImageEnView.Create(nil);
  with ImageEnView1 do begin
    IO.LoadFromFile( InputFilename );

    w := 375;        
    h := 375;
    with Proc with begin
        Resample(w, h, rfLanczos3, True);
        ConvertTo(256, ieThreshold); 
        Sharpen(10,4);
    end;

    IEBitmap.PixelFormat := ie8p; 
    IEGlobalSettings().AutoSetBitDepth := True;

    OutputFilename := ReplaceStr(InputFilename,'Cover','Folder'); 
    OutputFilename := ReplaceStr(OutputFilename,'.jpg','.png');

    IO.Params.PNG_Compression := 9;
    IO.SaveToFile(OutputFilename, ioPNG); 
    Free;
  end;

end;



Rudolf
Go to Top of Page

xequte

7079 Posts

Posted - Jul 24 2022 :  18:07:46  Show Profile  Reply
Hi Rudolf

I called your code with a the text of a TEdit containing a unicode string and it converted without error for me:

www.imageen.com/temp/UniTest.zip

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

brm121966

USA
30 Posts

Posted - Jul 25 2022 :  18:04:10  Show Profile  Reply
Hi Nigel.
Run your exe. See screenshot.
Maybe save doesn't work with a network folder?

P.S.
Tried to save before conversion, Saving works.

Rudolf



Go to Top of Page

xequte

7079 Posts

Posted - Jul 28 2022 :  00:54:49  Show Profile  Reply
Hi Rudolf

Network locations work fine for me too.

Please add this code before SaveToFile:

  if DirectoryExists( ExtractFilePath( OutputFilename )) = False then
    raise Exception.create( 'Directory not found: ' + ExtractFilePath( OutputFilename ));


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

brm121966

USA
30 Posts

Posted - Jul 28 2022 :  19:19:48  Show Profile  Reply
Hi Nigel.
I'm sorry. This is my bug. In the code, replacing the name also changed the value in the path. Please delete the forum thread.
I apologize again.
ImageEn is the best.

Rudolf
Go to Top of Page

xequte

7079 Posts

Posted - Jul 28 2022 :  23:16:25  Show Profile  Reply
Thanks for the update, Rudolf,

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: