1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Batch renaming and creating file : DOS

Discussion in 'DOS/Other' started by suBz3ro, Aug 9, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. suBz3ro

    suBz3ro Thread Starter

    Joined:
    Aug 9, 2006
    Messages:
    7
    Have problem here.

    i want to batch creating .png using DOS file if possible.
    Scenario is like this.

    i have list of filename. then i want to make png file from each of the filename
    for example

    test1.txt --> text1.png
    test2.txt -->text2.png
    hithere.txt --> hithere.png

    and so on.

    *all .png file context same image on it.

    thanks

    http://www.gothlair.net
     
  2. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    You just want to rename a bunch of TXT files to PNG files? Or do you want to do a graphics conversion from the text format to a graphics format? If it's just a rename, try:

    REN *.TXT *.PNG

    Job done. :D Obviously, if you want to do a graphics conversion, you need a program to do the job.
     
  3. suBz3ro

    suBz3ro Thread Starter

    Joined:
    Aug 9, 2006
    Messages:
    7
    thanks for your replied.

    my question is using filename string list to make a .png for each of the filename string.

    name1
    name2

    so on.
    *its a string.

    so want to create .png file from each of the string
    name1 --> name1.png
    the .png is from a default image, all .png files that created will have same image but different filename according to the filename list string
     
  4. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    I am not positive of what you just wrote, but here is what I think you meant:
    "I want a tool that will read a text file of assorted image filenames and convert each image into PNG format."
    Is that right?

    If so, I would use IrfanView, but IrfanView does not have (that I am aware of) the ability to read a textfile of filenames and convert each.

    However you could make a batch file to copy the desired images into a particular temp folder, and still within that batch file, to command IrfanView to convert the whole of that temp folder and place the resulting PNG files wherever you want, then finally delete the temp folder.

    It is a bit more involved than what I believe you asked for, but workable.

    By the way, I have sent a request off to Irfan Skiljan (the creator of IrfanView) to add a textfile reading/conversion ability. If more people also send him that same sort of request then he will see that it is a desirable feature request.
    See his webpage for his email address.
     
  5. suBz3ro

    suBz3ro Thread Starter

    Joined:
    Aug 9, 2006
    Messages:
    7
    ;) thanks bro.

    What i'm try to do is generate .png file from list of strings (echoing from php)

    example
    Deicide - Bible Basher
    Deicide - Scars_Of_The_Crucifix
    Dimmu Borgir - Progenies Of The Great Apocalypse

    each generated .png file will named as the string.
    Generated png file will have same width and height resolution.

    outcome
    Deicide - Bible Basher.png
    Deicide - Scars_Of_The_Crucifix.png
    Dimmu Borgir - Progenies Of The Great Apocalypse.png
     
  6. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    Sub0 you need to answer some questions, if you expect some useful answers.
    I asked you if you already have existing image files. Just having a list of strings will not be adequate to create a PNG (which is, and please correct me if I am wrong here, you mean a Portable Network Graphic).

    If you already have some graphics, what format are they (the 3 character file extension) ?
    If all you want to do is add the ".PNG" to the end of existing PNG files that don't have an extension, there are simple ways of doing that.
    If all your graphics are in some other image format, and you want to convert them all to PNG, with some size restriction, then tell us that.
    And that too, is an easy task for IrfanView.

    You are not giving any reason of why you want to work with this "list of strings"

    In your original message you said "all .png file context same image on it" ???
    Are you saying all you want to do is copy and rename an existing image?

    Need some answers.
     
  7. suBz3ro

    suBz3ro Thread Starter

    Joined:
    Aug 9, 2006
    Messages:
    7
    ;) thanks bro.

    maybe my questions there a bit confuse and hard to understand,my bad.
    i dont have any graphic. but i will create a default one (png or any image extension)

    what i have in mind is a batch tool or program that will read list of string (string and without any format) then create a png file according to the string list itself and end with png extension.The process will create same png image for png image that i have created. (sharing the same image content but different filename)

    process is like
    this list of string ---> automaking png file according to string list(only 1 png file but different name)
     
  8. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    I have been following this thread and I am still confused.
     
  9. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    I think I get it.

    He has one PNG file, let's say it's named SAMPLE.PNG

    He has a text file with a bunch of file names, let's say the contents are.

    filename1
    filename2
    filename3

    He wants to run a job that will copy the SAMPLE.PNG to each of the file names in the file, in this case he'd end up with

    filename1.png
    filename2.png
    filename3.png

    Each of the proceeding files would be a copy of SAMPLE.PNG

    Is that it?
     
  10. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
  11. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    Well, he has a list of names in a file, so it's not exactly the same process. Or at least, I think that's what is intended here...
     
  12. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    Ah, yes, I see your point. The filenames aren't consecutive. I could do this real easy with a Bash script but I never really did get into Batch files much. I am trying to learn the new PowerShell but haven't had much time.
     
  13. suBz3ro

    suBz3ro Thread Starter

    Joined:
    Aug 9, 2006
    Messages:
    7

    you hit the jackpot!.
    thats what i'm trying to say.
    any help or link where i can get help from?
     
  14. dtech10

    dtech10

    Joined:
    Jan 31, 2003
    Messages:
    53
    Somthing like this do, if you're using WinXP ,Win2000

    @echo off
    for /f %%a in (Names.txt) do copy Sample.png %%a.png
     
  15. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    Good solution dtech10, but there is a slight problem with the possible spaces, such as sub0's example of:
    Dimmu Borgir - Progenies Of The Great Apocalypse

    So, I propose a slight alteration of:
    Code:
    @echo off
    for /f "delims=~" %%a in (Names.txt) do copy Sample.png "%%a.png"
    
    Sub0, this allows spaces to be included in the text sent through to naming the .Png file. The quotes, after the COPY command, are there to ensure that those spaces are maintained.

    It also assumes that the tilde character (~) is NEVER used in any of your file names. If a tilde is there it will act like a "space" (the normal delimiter), and any text after that character will not be part of your to-be-created .png file.
    So, if the tilde is not the best character to use (best: being never used in any of your strings), then you should find out what other character you can use, and place it where the tilde is here.
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/490704

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice